ISDate Function

Returns a Boolean value indicating whether an expression can be converted to a date.

Syntax

IsDate(expression)

Arguments:

Expression: Required. Any date expression or string expression recognizable as a date or time.

Supported Date Formats:

  • MM-DD-YYYY
  • MM/DD/YYYY
  • DD-MM-YYYY
  • DD/MM/YYYY
  • YYYY-MM-DD
  • YYYY/MM/DD

Remarks

IsDate returns True if the expression is a date or can be converted to a valid date; otherwise, it returns False. 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.

The following example uses the IsDate function to determine whether an expression can be converted to a date

Example 1:

Dim NoDate, MyCheck
NoDate = "Hello"
MyCheck = IsDate(NoDate)
'Output: False

Example 2:

Dim Date1, Date2, Date3, MyCheck
Date1 = "01/21/2025"   ' US format (MM/DD/YYYY)
Date2 = "21-01-2025"   ' European format (DD-MM-YYYY)
Date3 = "2025-01-21"   ' ISO format (YYYY-MM-DD)
MyCheck = IsDate(Date1)   ' Returns True.
'Output: True
MyCheck = IsDate(Date2)   ' Returns True.
'Output: True
MyCheck = IsDate(Date3)   ' Returns True.
'Output: True