Date formats
Joakim Schramm
joakim at astrocalc.com
Wed May 3 21:06:10 CDT 2006
Hi,
Working with the DateTime field type I notices .Value and .GetString returns
the data and time in different formats as for
.Value = 31/10/2010 03:00:00
.GetString = 2010/10/31 03:00:00:000
This is probably as intended were one return the system set date format
while the other return format set by EVDateFormat as .kYMD in this case. I
am not an expert on this and I know dates can be tricky. However (and I
don't know if this is specific to VB), according to a part of the VB
documentation on "Writing International Code in Visual Basic" the prefered
format to use in code is #month/day/year# as this is understood correctly in
all locales. So I would like to raise the question if it wouldn't be better
to use this format for the Value property, or possibly another property to
cope with this? As I said, I don't know if this just apply to VB but I
suspect it would be correctly interpretted in all COM languages at least.
Regards,
Joakim
>From the VB documentation:
Date
In Visual Basic, never type dates as strings in your code. Entering dates in
code in the format #month/day/year# ensures that the date will be
interpreted correctly in any system locale. Because Visual Basic allows only
English/U.S. as a programming locale, the date will be the same to a user
wherever your application is run.
For example, if a user enters 8/2/97 in an input dialog box,
CDate ("8/2/97")
returns the following results, based on the system locale:
Operating system Output
French/France 08/02/97 (= February 8, 1997)
English/U.S. 8/2/97 (= August 2, 1997)
Conversely, if you enter 8/2/97 in code,
CDate (#8/2/97#)
returns the results in the following table, based on the code locale:
Operating system Output
French/France 02/08/97 (= August 2, 1997)
English/U.S. 8/2/97 (= August 2, 1997)
More information about the Valentina
mailing list