Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Funky cDate Conversions
Message
 
To
21/12/2000 08:25:49
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00455403
Message ID:
00456313
Views:
28
Funky for sure. Even that would mean the 1,012,001 day since the year 1785.
Which when added to that year, would equal around the year 4670. I constantly need to know how many days have elapsed since the year 1785 ;)

>Ed,
>
>When you see cDate("01012001"), you see Jan 1st, 2001, but what VB sees is "the day number one million twelve thousands and one (1,012,001)".
>
>
? cDate("1")   ' cDate(1) gives the same answer
>12/31/1899     ' December 31st, 1899 seems to be days one according to VB
>
>? cDate("2")
>01/01/1900
>
>? cDate("3")
>01/02/1900
>
>...
>
>? cDate("01011999")
>10/3/4670
>
>? cDate("01012000")
>10/4/4670
>
>? cDate("01012001")
>10/5/4670
>
>>I have users that enter dates such as "01012001" in a date field,
>>the validate method calls cDate(), which I would expect to return 01/01/2001,
>>but check it out:
>>
>>? cDate("01012001")
>>10/5/4670
>>
>>? cDate("010101")
>>8/27/1927 ' Didn't see this one coming
>>
>>Star trek dates! Obviously if the dashes or slashes are in the date, it works correctly. Rather than writing my own routine to insert them, does anyone know of a quick date conversion that works correctly (or even explain the magic under the hood here?). There doesn't seem to be behind the scenes information on how VB is coming up with the results...
>>
>>TIA,
>>Ed VanDuyne
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform