Table of contents
TOC
Collapse the table of content
Expand the table of content

IsDate Function

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Returns True if the expression is a date or is recognizable as a valid date or time; otherwise, it returns False. SyntaxIsDate(expression) The required expressionargument is aVariant containing adate expression orstring 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.

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.
© 2017 Microsoft