CompuServe Thread

#DateValue bug in VB

4 messages in this thread
#2832From: Isaac RabinovitchOct 13, 1991 2:12 AM
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.
#3190From: Don FunkOct 15, 1991 10:45 AM
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.
#3309From: Isaac RabinovitchOct 15, 1991 9:30 PM
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)".
#3381From: Nelson FordOct 16, 1991 8:07 AM
Check the sample code in TP1015.EXE (the update to VBTIPS) on DL1. I think it chokes when you use the "Dec 30" format.