Date.TotalSeconds

From Xojo Documentation

Revision as of 21:54, 12 August 2019 by Gperlman (talk | contribs)

Property (As Double )
aDate.TotalSeconds = newDoubleValue
or
DoubleValue = aDate.TotalSeconds

Supported for all project types and targets.

The number of seconds since 12:00AM, January 1, 1904, local time.

Notes

TotalSeconds is the "master" property from which other ways of expressing date/time are derived. A negative value of TotalSeconds indicates a Date/Time prior to January 1, 1904. Very, very large values of TotalSeconds will cause the value to be set to zero.

On Windows (due to the Windows API being used), it is not possible to go back further than 1 January 1601.

Sample Code

You can use TotalSeconds to calculate elapsed seconds:

Dim d As New Date
Dim startTime As Double = d.TotalSeconds
// Do some long process
d = New Date
Dim endTime As Double = d.TotalSeconds
Dim elapsedSeconds = endTime - startTime