SpanTotalHours
See Also: Time and Date Functions
Purpose
Calculates the total number of hours in the time span.
Return Type
Syntax
(SpanTotalHours( {tsVar} ))
Where:
- {tsVar} is a value of type TimeSpan.
What it Does
The SpanTotalHours function calculates the total number of hours in the time span and returns a double precision real number of that amount.
Example
This sample shows how to check the number of hours that have passed since 12/31/2007 at one second before midnight.
Procedure TestSpanTotalDays
DateTime dtVar1 dtVar2
TimeSpan tsVar
// Set dtVar1 to 12/31/2007, 11:59:59pm
Move (DateSetYear(dtVar1, 2007)) to dtVar1
Move (DateSetMonth(dtVar1, 12)) to dtVar1
Move (DateSetDay(dtVar1, 31)) to dtVar1
Move (DateSetHour(dtVar1, 23)) to dtVar1
Move (DateSetMinute(dtVar1, 59)) to dtVar1
Move (DateSetSecond(dtVar1, 59)) to dtVar1
Move (CurrentDateTime()) to dtVar2
Move (dtVar2 - dtVar1) to tsVar
Showln "The total days between " dtVar1 " and " dtVar2 " is " (SpanTotalHours(tsVar))
End_Procedure