For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > April 2005 > International date formats









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 International date formats
Tony Proctor

2005-04-14, 4:01 pm

Can anyone point me to a link that confirms whether the VB functions CDate()
and DateValue() accept international date formats such as "yyyy-mm-dd" ? For
instance, the same as SQLServer does.

I've tried it with lots of different regional settings and it seems to work
fine, e.g.

CDate ("2005-1-2") always gives 2nd Jan (not 1st Feb)

However, I can find no definitive statement on the subject. MSDN merely
suggests that the month/day order is dictated by the date patterns in your
regional settings

Tony Proctor


Jeff Johnson [MVP: VB]

2005-04-14, 4:01 pm


"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:ueP8byOQFHA.3156@TK2MSFTNGP15.phx.gbl...

> Can anyone point me to a link that confirms whether the VB functions
> CDate()
> and DateValue() accept international date formats such as "yyyy-mm-dd" ?
> For
> instance, the same as SQLServer does.
>
> I've tried it with lots of different regional settings and it seems to
> work
> fine, e.g.
>
> CDate ("2005-1-2") always gives 2nd Jan (not 1st Feb)
>
> However, I can find no definitive statement on the subject. MSDN merely
> suggests that the month/day order is dictated by the date patterns in your
> regional settings


Can't give you anything definitive except real-world results:

? CDate("2005-14-04") --> Type Mismatch Error

? CDate("2005-04-14") --> April 14 2005

Same thing if you drop the leading zero in 04.


Medhat

2005-04-27, 9:00 am

You should change the date format in the regional settings in the control
panel first, then it should work
Regards
Medhat
"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in message
news:ueP8byOQFHA.3156@TK2MSFTNGP15.phx.gbl...
> Can anyone point me to a link that confirms whether the VB functions
> CDate()
> and DateValue() accept international date formats such as "yyyy-mm-dd" ?
> For
> instance, the same as SQLServer does.
>
> I've tried it with lots of different regional settings and it seems to
> work
> fine, e.g.
>
> CDate ("2005-1-2") always gives 2nd Jan (not 1st Feb)
>
> However, I can find no definitive statement on the subject. MSDN merely
> suggests that the month/day order is dictated by the date patterns in your
> regional settings
>
> Tony Proctor
>
>



Tony Proctor

2005-04-27, 9:00 am

No I shouldn't Medhat!

What I'm obviously interested in doing is passing dates between different
locales using an unambiguous representation, which is exactly why SQLServer
accepts that same format.

Tony Proctor

"Medhat" <medhat@elkanto.com> wrote in message
news:O8ncaZwSFHA.2424@TK2MSFTNGP09.phx.gbl...
> You should change the date format in the regional settings in the control
> panel first, then it should work
> Regards
> Medhat
> "Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.com> wrote in

message
> news:ueP8byOQFHA.3156@TK2MSFTNGP15.phx.gbl...
your[color=darkred]
>
>



Sponsored Links







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

Copyright 2008 codecomments.com