[Gambas-user] gb.GeneralDate formatting is inconsistent

Zach Smith zachsmith022 at ...626...
Mon Feb 6 06:44:25 CET 2012


> gb.GeneralDate prints the date part the short way (dd/mm/yy) and prints
> the time if it is not zero.

The middle example is still inconsistent if one expects 00:00:00 to be
a valid time, that is, midnight (12:00 AM).  Also note that the format
is mm/dd/yy only if the time is not 00:00:00.  One can get around this
by using a "mm/dd/yyyy hh:nn:ss" format string but having
gb.GeneralDate work for all dates and times would be helpful.

---------------------------------------------------
Dim d1 As Date, d2 As Date, d3 As Date

d1 = CDate("12/31/2002 23:59:59")
d2 = CDate("1/1/2003 00:00:00")
d3 = CDate("1/1/2003 00:00:01")

Print Format(d1, gb.GeneralDate)
Print Format(d2, gb.GeneralDate)
Print Format(d3, gb.GeneralDate)
---------------------------------------------------
12/31/2002 23:59:59
01/01/03
01/01/2003 00:00:01




More information about the User mailing list