IsTimeValid
See Also: Time and Date Functions
Purpose
This function returns True if the passed Time variable is valid. It tests that all of the parts of the time span fit within the allowable range for that part.
Return Type
Syntax
(IsTimeValid({tVar}))
Where:
- {tVar} is a value of type Time.
Example 1
This sample initializes a Time variable to 10:10:30 AM and tests its validity.
Procedure Test
Time tmVar
Move (DateSetSecond(tmVar, 30)) To tmVar
Move (DateSetMinute(tmVar, 10)) To tmVar
Move (DateSetHour(tmVar, 10)) To tmVar
// prints
// The Time 10:10:30 is valid
Showln "The Time " tmVar " is" (If(IsTimeValid(tmVar), "", " not")) " valid"
End_Procedure
Example 2
This sample initializes an invalid Time variable (there can't be more than 23 hours) and tests its validity.
Procedure Test
Time tVar
Move (DateSetSecond(tVar, 30)) To tVar
Move (DateSetMinute(tVar, 10)) To tVar
Move (DateSetHour(tVar, 30)) To tVar
// prints
// The Time 18:10:30 is not valid
Showln "The Time " tVar " is" (If(IsTimeValid(tVar), "", " not")) " valid"
End_Procedure