Method: IsDate for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: IsDate for VBS
Method: IsDate for VBS
Specifies whether an expression contains a valid date.
vIsDate = Object.IsDate(expression)
| Object | VBS Object with this method. You do not need to specify this object. |
| expression | Variant Specifies any expression. |
| vIsDate | Variant The IsDate method returns True if the expression contains a valid date. Otherwise the method returns False. |
The following example checks whether a variable contains a valid date:
MyDate = "1/1/2011" Call MsgBox(IsDate(MyDate)) ' Returns True MyDate = #10/1/11# Call MsgBox(IsDate(MyDate)) ' Returns True MyDate = "No Date" Call MsgBox(IsDate(MyDate)) ' Returns False MyDate = "4711 Call MsgBox(IsDate(MyDate)) ' Returns False