Skip to content

SpanTotalDays

See Also: Time and Date Functions

Purpose

Calculates the total number of days in the time span.

Return Type

Real

Syntax

(SpanTotalDays({tsVar}))

Where:

What it Does

The SpanTotalDays function calculates the total number of days in the time span and returns a double precision real number of that amount.

Example

This sample shows how to check the number of days 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 " (SpanTotalDays(tsVar))
End_Procedure