This documentation is archived and is not being maintained.

IsDate Function

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

Public Function IsDate(ByVal Expression As Object) As Boolean

Parameter

Expression
Required. Object expression.

Remarks

IsDate returns True if the expression is of type Date or is a string convertible to type Date; otherwise, it returns False.

Example

This example uses the IsDate function to determine if several variables can be converted to dates.

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

Requirements

Namespace: Microsoft.VisualBasic

Module: Information

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

IsArray Function | IsDBNull Function | IsError Function | IsNothing Function | IsNumeric Function | IsReference Function | Object Data Type | Date Data Type | TypeName Function

Show: