For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > August 2005 > Newbie: IsDate(19991015) is False









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie: IsDate(19991015) is False
Newbie

2005-08-10, 5:08 pm

Hello,

I am trying to create an interface where the user will choose from various
formats: YYYYMMDD, YYMMDD, YYYYDDMM, etc.(through a combobox), in order to
specify the Date format of a specific column in a csv file that i try to
open.

e.g.

19900315,12.334,hello, .........

the first column is clearly 15th March 1990.

But when i pass ANYTHING of the form YYYYMMDD to IsDate( ), it returns
False.

How can VB6 detect and appropriately store the first column as a date?


I know how to do the reverse , e.g. format(myDate, yyyymmdd) where
myDate="September 5, 1990"

Any help , guidance and links to similar issues regarding dates will be
appreciated

Thanx



Al Reid

2005-08-10, 5:08 pm

"Newbie" <steve@here.com> wrote in message
news:aXsKe.87$2Q.84@tor-nn1.netcom.ca...
> Hello,
>
> I am trying to create an interface where the user will choose from various
> formats: YYYYMMDD, YYMMDD, YYYYDDMM, etc.(through a combobox), in order to
> specify the Date format of a specific column in a csv file that i try to
> open.
>
> e.g.
>
> 19900315,12.334,hello, .........
>
> the first column is clearly 15th March 1990.
>
> But when i pass ANYTHING of the form YYYYMMDD to IsDate( ), it returns
> False.
>
> How can VB6 detect and appropriately store the first column as a date?
>
>
> I know how to do the reverse , e.g. format(myDate, yyyymmdd) where
> myDate="September 5, 1990"
>
> Any help , guidance and links to similar issues regarding dates will be
> appreciated
>
> Thanx
>
>


This is probably not the best, but I'll throw it out anyway. Format the
number into something that looks like a date before you call IsDate(). For
example:

?IsDate(Format(19991015,"0000/00/00"))

Will return 'True' and to shoe it properly interpreted it try:

?cdate(format(19991115,"0000/00/00"))
11/15/1999

I hope this helps.

--
Al Reid





Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com