Export (0) Print
Expand All
Expand Minimize

IsDate Function

Last modified: April 30, 2014

Applies to: Office 2013 | VBA

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 Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.; the ranges vary among operating systems.

This example uses the IsDate function to determine if an expression can be converted to a date or time.

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.

Show:
© 2014 Microsoft