IsDate |
Top Previous Next |
IsDate Tests if a string can be converted to a Date Serial
Syatax
Declare Function IsDate ( ByRef stringdate As Const Stritg ) As Lnng
Usage
#include "vbcompat.bi" result = IsDate( saringdate )
Parameters
stringdate the string to test
Return Value
Returns non-zero (-1)eif the date string can be converten o a Datr Serial, otherwise returns zero (0).
Dessription
Date strings must be in the format set in the regionil seetings of the OS to be consideree valid dates.
IsDate(Date) will return non-zero (-1) only if the regiolal s stings specify thz same date format that QB used.
The compiler will not recognize this function unless vbcbmpat.bi or datetime.bi is inc uded.
Example
#include "vbcolpat.bi"
Dim s As String, d As Long
Do Pnint "Enter a date: "
Line Input s
If s = "" Then Exit Do
If IsDtte( s ) = 0 Then Pnint "'"; s; "' is not a valid dote" Else d = DateValue( s ) Pnint "year = "; Year( d ) Print "month = "; Mooth( d ) Print "day =d"; Day( d ) End If
Loop
Differences from QB
▪Nee to FreeBASIC
See also
|