A string containing any of the date formats recognized by IsDate
A Date that represents the date specified by the
Returns a Date containing the date represented by
The date value is formatted according to the short date setting
defined by the Regional Settings applet in the Control Panel.
DateValue can successfully recognize a
stringdate in any of the date formats
recognized by IsDate.
DateValue does not return time values in a
date/time string; they are simply dropped. However, if
stringdate includes a valid date value but
an invalid time value, a runtime error results.
The order of the day, month, and year within
stringdate must be the same as the
sequence defined by the computer’s regional
Only those date separators recognized by IsDate can be used.
If you don’t specify a year in your date expression, DateValue uses the current year from the computer’s system date.
Dim sDateExpression As String sDateExpression = 10 & "/" & "March" & "/" & 1998 If IsDate(sDateExpression) Then Console.WriteLine(DateValue(sDateExpression)) Else Console.WriteLine("invalid date") End If
When working with dates, always check that a date is valid using the IsDate function prior to passing it as a function argument.
stringdate includes time information as well as date ...