IsDate function
Returns True if the expression is a date or is recognizable as a valid date or time; otherwise, it returns False.
Syntax
IsDate(expression)
The required expression argument is a Variant containing a date expression or string expression recognizable as a date or time.
Remarks
In Windows, the range of valid dates is January 1, 100 A.D., through December 31, 9999 A.D.; the ranges vary among operating systems.
Example
This example uses the IsDate function to determine if an expression is recognized as a date or time value.
Dim MyVar, MyCheck
MyVar = "04/28/2014" ' Assign valid date value.
MyCheck = IsDate(MyVar) ' Returns True.
MyVar = "April 28, 2014" ' Assign valid date value.
MyCheck = IsDate(MyVar) ' Returns True.
MyVar = "13/32/2014" ' Assign invalid date value.
MyCheck = IsDate(MyVar) ' Returns False.
MyVar = "04.28.14" ' Assign valid time value.
MyCheck = IsDate(MyVar) ' Returns True.
MyVar = "04.28.2014" ' Assign invalid time value.
MyCheck = IsDate(MyVar) ' Returns False.
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.