Date literal bigotry
Posted
Thu, Jul 8 2004 7:02
by
bill
In VB6, if I declared a variable as a Date, I could then assign a literal to it such as :
Dim dt as Date
dt = #30 Jun 2004#
The IDE would change that to #6/30/2004#. This was always a bit of an annoyance, and you could tell it was American based, not European or Australian. In fact I always have that issue with American dates, when the numbers could be interpreted either way, eg 4/8/2004. Is that August or April? Depends on where you are ;)
VB generally is really good with Dates at runtime, as it is local aware. At design time though, it’s just plain bigotry. Vb.NET is actually worse than VB6, as VB.NET does not even parse the literal. That is, it doesn’t recognize #30 Jun 2004#.
I really wish they would fix this and allow for date literals to be less ambiguous, and allow not only the entering in of dates as #30 Jun 2004#, but also allow for that format to be preserved and applied to all date literals. Why? Well because it is non ambiguous!