IsDate Function |
Microsoft.VisualBasic.Information
IsDate( expression )
Expression containing a date or time
Boolean indicating whether the expression can be converted to a Date
Determines if an expression is of type Date or can be converted to type Date
Returns True if and only if expression is of type Date or can be converted to type Date.
Uninitialized date variables also return True .
IsDate uses the locale settings of the current Windows system to determine if the value held within the variable is recognizable as a date. Therefore, what is a legal date format on one machine may fail on another.
IsDate is particularly useful for validating data input. However, don't use IsDate in the VB text box control's Change event. The Change event is fired with every keystroke, which means that when the user starts to enter the date, chances are that the date will be invalid until the point at which the user has completed the data entry.