StructToTime

Converts an FTODate object to a Unix timestamp.

Syntax

StructToTime(ftoDate: FTODate): number

Parameters

  • ftoDate: FTODate - The FTODate object to convert to timestamp

Return Value

Returns a number representing the Unix timestamp in seconds since epoch.

Description

The StructToTime method converts an FTODate object to its Unix timestamp representation (seconds since epoch). This is useful when you need to convert from the structured date/time format to a numeric timestamp for calculations or storage.

Example

// Convert current time to timestamp
const currentDate = this.api.TimeCurrent();
const timestamp = this.api.StructToTime(currentDate);
console.log(`Current time as timestamp: ${timestamp}`);

// Convert and compare two dates
const date1 = this.api.TimeCurrent();
const timestamp1 = this.api.StructToTime(date1);
console.log(`Current time as timestamp: ${timestamp1}`);

Last updated