SpanSeconds
See Also: Time and Date Functions
Purpose
Returns the second component of the given time span.
Return Type
Syntax
(SpanSeconds({tsVar}))
Where:
- {tsVar} is a value of type TimeSpan.
What it Does
The SpanSeconds function returns the second component of the given TimeSpan variable field, tsVar.
Example
This sample shows the total time that has passed since 12/31/2007 at one second before midnight.
Procedure TestSpanMilliSeconds
DateTime dtVar1 dtVar2
TimeSpan tsVar
// Set dtVar1 to 12/31/2007, 11:59:59.01 PM
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 (DateSetMillisecond(dtVar1, 10)) to dtVar1
Move (CurrentDateTime()) to dtVar2
Move (dtVar1 - dtVar2) to tsVar
Showln "The time passed between " dtVar1 " and " dtVar2 " is"
Show (SpanDays(tsVar)) " days, "
Show (SpanHours(tsVar)) " hours, "
Show (SpanMinutes(tsVar)) " minutes, "
Show (SpanSeconds(tsVar)) " seconds and "
Showln (SpanMilliseconds(tsVar)) " milliseconds"
End_Procedure
Notes
To find the total number of seconds between two DateTime variables, use the SpanTotalSeconds function.