<cDateTime>.DateToSeconds

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > Date and Time > cDateTime > cDateTime_Methods >

<cDateTime>.DateToSeconds

 

Description

 

Returns value representing the cDateTime objects in seconds.

 

Syntax

 

<cDateTime>.DateToSeconds

 

Returns

 

None.

 

Parameters

 

Name

Type

Optional

Meaning

otherCDateTime

cDateTime

No

Other cDateTime object to compare date with.

 

Remarks

 

Restrictions

 

Useful for comparison of two cDateTime variables from seconds perspective, but please do not rely on absolute values - the beginning of epoch might change in the future!

 

See also

 

Examples

 

' Create an object with current date and time

Dim firstDateTime As New cDateTime

 

' Set its values

firstDateTime.NewDate(2020, 12, 24)

firstDateTime.NewTime(20, 0, 0)

 

' Create another object with current date and time

Dim secondDateTime As New cDateTime

 

' Set its values

secondDateTime.NewDate(2021, 11, 25)

secondDateTime.NewTime(20, 30, 0)

 

' Calculate relative difference in seconds

Quad diffInSeconds = secondDateTime.DateToSeconds - firstDateTime.DateToSeconds

 

' Display difference

MsgBox 0, "Difference in seconds: " + diffInSeconds