Date and time
Date, time and duration are a set of virtual data types, which are internally represented as numbers using unix timestamps (numbers).
Operators
Refer to a full list of number operators.
Functions
date
Accepts a formatted string as an input and returns a unix timestamp in seconds.
Syntax
date('now');
date('yesterday');
date('2022-01-01');
date('2022-01-01 16:00');
date('2022-04-04T21:48:30Z');
time
Accepts a formatted string as an input and returns a number representing seconds from midnight.
Syntax
time('21:49');
time('21:48:20');
time('2022-04-04T21:48:30Z'); // extracts time from date string
duration
Accepts a formatted string (from seconds up to hour) as an input and returns duration in seconds.
Syntax
duration('1h'); // 3600
duration('30m'); // 1800
duration('10h'); // 36000
dayOfWeek
Accepts a unix timestamp and returns the day of the week as a number.
Syntax
dayOfWeek(date('2022-11-08')); // 2
dayOfMonth
Accepts a unix timestamp and returns the day of the month as a number.
Syntax
dayOfMonth(date('2022-11-09')); // 9
dayOfYear
Accepts a unix timestamp and returns the day of the year as a number.
Syntax
dayOfYear(date('2022-11-10')); // 314
weekOfMonth
Accepts a unix timestamp and returns the week of the month as a number.
Syntax
weekOfMonth(date('2022-11-11')); // 2
weekOfYear
Accepts a unix timestamp and returns the week of the year as a number.
Syntax
weekOfYear(date('2022-11-12')); // 45
seasonOfYear
Accepts a unix timestamp and returns the seasons of the year as a string.
Syntax
seasonOfYear(date('2022-11-13')); // Autumn
monthString
Accepts a unix timestamp and returns the month of the year as a string.
Syntax
monthString(date('2022-11-14')); // Nov
weekdayString
Accepts a unix timestamp and returns the day of the week as a string.
Syntax
weekdayString(date('2022-11-14')); // Mon