TimeGMT

Returns the current GMT (UTC) time.

Syntax

TimeGMT(): FTODate

Return Value

Returns an FTODate object representing the current GMT time.

Description

The TimeGMT method returns the current GMT (UTC) time as an FTODate object. This time is independent of the project's timezone settings and represents the universal coordinated time.

Example

// Get current GMT time
const gmtTime = this.api.TimeGMT();
console.log(`GMT time: ${gmtTime.toString()}`);

// Compare with local time
const localTime = this.api.TimeLocal();
console.log(`Local time: ${localTime.toString()}`);

// Calculate time difference
const diffInHours =
  (localTime.getTime() - gmtTime.getTime()) / (1000 * 60 * 60);
console.log(`Time difference from GMT: ${diffInHours} hours`);

// Format GMT components
console.log(
  `GMT Date: ${gmtTime.yearOf()}.${gmtTime.monthOf()}.${gmtTime.dayOfMonth()}`
);
console.log(
  `GMT Time: ${gmtTime.hour()}:${gmtTime.minute()}:${gmtTime.second()}`
);

Last updated