See Also: Time and Date Functions
This returns True if the passed TimeSpan variable is valid. It tests that all of the parts of the time span fit within the allowable range for that part.
(IsTimeSpanValid( {tsVar} ))
Where:
{tsVar} is a value of type TimeSpan
This sample initializes a valid TimeSpan variable and tests its validity.
Procedure Test
TimeSpan tsVar
Move (DateSetSecond(tsVar, 30)) to tsVar
Move (DateSetMinute(tsVar, 10)) to tsVar
Move (DateSetHour(tsVar, 10)) to tsVar
Move (DateSetDay(tsVar, 30)) to tsVar
// prints
// The TimeSpan 30:10:10:30 is valid
Showln "The TimeSpan " tsVar " is" (If(IsTimeSpanValid(tsVar),""," not")) " valid"
End_Procedure
This sample initializes a invalid TimeSpan variable (there can't be more than 23 hours) and tests its validity.
Procedure Test
TimeSpan tsVar
Move (DateSetSecond(tsVar, 30)) to tsVar
Move (DateSetMinute(tsVar, 10)) to tsVar
Move (DateSetHour(tsVar, 30)) to tsVar // too many hours
Move (DateSetDay(tsVar, 30)) to tsVar
// prints
// The TimeSpan 30:10:30:30 is not valid
Showln "The TimeSpan " tsVar " is" (If(IsTimeSpanValid(tsVar),""," not")) " valid"
End_Procedure