IsDate Function

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

Syntax

IsDate ( expression )

The required expressionargument is a Variant containing a date expression or string expression recognizable as a date or time.

Remarks

IsDate returns True if the expression is a date or is recognizable as 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.

Query examples

Expression

Results

SELECT IsDate([UnitPrice]) AS Expr1 FROM ProductSales;

The function evaluates if the "UnitPrice" is a valid Date and returns the result as "-1" for True and "0" for False in the column Expr1. Result is 0 (False).

SELECT IsDate([DateofSale]) AS ValidDate, IsDate(#31/10/2019#) AS DateTest FROM ProductSales;

The function evaluates if the "DateofSale" and "#31/10/2019#" is a valid Date and returns the result as "-1" for True and "0" for False in the column ValidDate and DateTest respectively. Result is -1 (True) in both columns.

VBA example

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

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

Dim MyDate, YourDate, NoDate, MyCheck
MyDate = "February 12, 1969"
YourDate = #2/12/69#
NoDate = "Hello"
MyCheck = IsDate(MyDate) ' Returns True.
MyCheck = IsDate(YourDate) ' Returns True.
MyCheck = IsDate(NoDate) ' Returns False.

Need more help?

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

×