#DateValue bug in VB
4 messages in this thread
Has anybody reported the DateValue bug in Visual Basic. Nothing in the
knowledge base. Summary: DateValue takes a date in string form and
produces the equivalent date/time serial number. If you leave out the
year, DateValue is supposed to assume the current year. This works OK if
the month is given as a number, but if the month is given as a name or
abbreviation it makes an amusing conversion error.
There is 1 Reply.
Hi Isaac,
I tried the following and got the same serial date printed each time.
Could you include code that shows this.
Don Funk
Sub Form_Click ()
'33602
Print DateValue("30-Dec-91")
Print DateValue("12/30")
Print DateValue("30-Dec")
End Sub
There are 2 Replies.
Hmm. Interesting that all those funny formats you used worked. Never seen
them used before. Anyway, the one that doesn't work is the one that's most
standard. Try "December 31, 1991". Note that this is the long format you
get if you set the Windows Control Panel to "English (US)".
Check the sample code in TP1015.EXE (the update to VBTIPS) on DL1. I think
it chokes when you use the "Dec 30" format.