🗓️ Date & Time Functions
Create, format, and measure dates and timestamps.
| Function | Description | Syntax | Parameters | Example |
|---|---|---|---|---|
TODATE |
Converts text into a date, using the given date format. | TODATE(Text, Date Format) |
Text — the text to convert.Date Format — how to interpret the text as a date. | TODATE('20210101', 'YYYYMMDD') |
TODATE_TZ |
Converts text into a date, using the given date format and time zone. | TODATE_TZ(Text, Date Format, Timezone) |
Text — the text to convert.Date Format — how to interpret the text.Timezone — the time zone to apply. | TODATE_TZ('20210101', 'YYYYMMDD', 'Europe/Amsterdam') |
TODAY |
Returns the current date, in UTC. Takes no arguments. | TODAY() |
None. | TODAY() > TODATE('2021-12-12', 'YYYY-MM-DD') = true |
NOW |
Returns the current date and time, in UTC. Takes no arguments. | NOW() |
None. | NOW() > TODATE('2021-12-12 13:00:00', 'YYYY-MM-DD HH24:MI:SS') |
DATETIME_FORMAT |
Converts a date into text, formatted according to the given pattern. | DATETIME_FORMAT(Date, Format) |
Date — the date to convert.Format — the text pattern to apply. | DATETIME_FORMAT(TODATE('2024-01-01', 'YYYY-MM-DD'), 'YYYY') = '2024' |
DATETIME_FORMAT_TZ |
Converts a date into text, formatted according to the given pattern and time zone. | DATETIME_FORMAT_TZ(Date, Format, Timezone) |
Date — the date to convert.Format — the text pattern to apply.Timezone — the time zone to apply. | DATETIME_FORMAT_TZ(FIELD('Due Date'), 'YYYY-MM-DD HH24:MI', 'Europe/Amsterdam') |
YEAR |
Returns the year from a date. | YEAR(Date) |
Date — the date to extract from. | YEAR('2024-01-01') = 2024 |
MONTH |
Returns the month (1–12) from a date. | MONTH(Date) |
Date — the date to extract from. | MONTH(TODATE('2021-12-12', 'YYYY-MM-DD')) = 12 |
DAY |
Returns the day of the month (1–31) from a date. | DAY(Date) |
Date — the date to extract from. | DAY(TODATE('20210101', 'YYYYMMDD')) = 1 |
SECONED³ |
Returns the seconds component of a date/time value. | SECONED(Date) |
Date — the date/time to extract from. | SECONED(TODATE('2024-01-01 08:34:02', 'YYYY-MM-DD HH24:MI:SS')) = 2 |
DATE_DIFF |
Calculates the difference between two dates in a given unit (year, month, week, day, hour, minute, or second). |
DATE_DIFF(Unit, Date 1, Date 2) |
Unit — the unit of time to measure in.Date 1 — the starting date.Date 2 — the ending date. | DATE_DIFF('year', TODATE('2000-01-01', 'YYYY-MM-DD'), TODATE('2020-01-01', 'YYYY-MM-DD')) = 20 |
DATE_INTERVAL |
Returns a date interval (e.g. "1 year", "3 months") for use in date arithmetic. | DATE_INTERVAL(Text) |
Text — the interval to create. | DATE_INTERVAL('1 year') |