Siebel VB Language Reference > VB Language Reference >
IsDate Function
This standard VB function indicates whether or not an expression is a legal date. Syntax
IsDate(expression)
|
|
expression |
Any valid expression |
Returns
-1 (TRUE) if expression is a legal date, 0 (FALSE) if it is not. Usage
IsDate returns -1 (TRUE) if the expression is of vartype 7 (date) or a string that can be interpreted as a date. Example
This example adds a number to today's date value and checks to see if it is still a valid date (within the range January 1, 100 AD, through December 31, 9999 AD). Sub Button_Click Dim curdatevalue Dim yrs Dim msgtext curdatevalue = DateValue(Date$) yrs = 20 yrs = yrs * 365 curdatevalue = curdatevalue + yrs If IsDate(curdatevalue) = -1 then msgtext = Format(CVDate(curdatevalue)) Else "The date is not valid." End If End Sub
Related Topics
CVDate Function IsEmpty Function IsNull Function IsNumeric Function VarType Function
|