getCurrentTime

Get the current time as a Unix timestamp in seconds.

Available in read and write scripts. Part of the virtual tag expression reference.

Returns the current time as a Unix timestamp in seconds. Most useful together with getTimeBefore and the history functions.

getCurrentTime(): number;

Return value

The current time, in seconds since the Unix epoch.

Example

const now = getCurrentTime();
historyValue("Outdoor/Temperature", getTimeBefore("24h", now));