All functions > DATE AND TIME
All functions in the DATE AND TIME category.
Backend availability
DD Available DD Partially available DD Not available DD DuckDB · PG Postgres · CH ClickHouse · TR Trino · BQ BigQuery · SF Snowflake · DB Databricks · SV Serving
Date/timestamp arithmetic
| Function | Description | Backends |
|---|
ADD() | Returns the timestamp after adding an interval to a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
DATE_ADD() | Returns the date/timestamp after adding a given number of a given units to the given date or... | DD | PG | CH | TR | BQ | SF | DB | SV |
SUBTRACT() | Subtracts an interval from a timestamp or date, or returns the interval between two timestamps or... | DD | PG | CH | TR | BQ | SF | DB | SV |
DATE_SUBTRACT() | Returns the number of complete elapsed units in timestamp1 − timestamp2. Chaining-friendly: the... | DD | PG | CH | TR | BQ | SF | DB | SV |
DATE_DIFF() | Returns the number of calendar boundary crossings in timestamp1 − timestamp2. Same argument order... | DD | PG | CH | TR | BQ | SF | DB | SV |
Calendar queries
| Function | Description | Backends |
|---|
FIRST_DAY_OF() | Returns the first calendar day of the period containing the given date or timestamp: a DATE for a... | DD | PG | CH | TR | BQ | SF | DB | SV |
LAST_DAY_OF() | Returns the last calendar day of the period containing the given date or timestamp: a DATE for a... | DD | PG | CH | TR | BQ | SF | DB | SV |
DAYS_IN() | Returns the number of calendar days in the MONTH, QUARTER, HALF (half-year), or YEAR that contains... | DD | PG | CH | TR | BQ | SF | DB | SV |
Sequence generation
| Function | Description | Backends |
|---|
SEQUENCE() | Generates an inclusive array of dates or timestamps separated by an interval. | DD | PG | CH | TR | BQ | SF | DB | SV |
DATE_SEQUENCE() | Returns an array of timestamps: `count` values beginning at `start`, each separated by `interval`. | DD | PG | CH | TR | BQ | SF | DB | SV |
Extraction
| Function | Description | Backends |
|---|
DATE_PART() | Returns the part of the given timestamp in the given unit. | DD | PG | CH | TR | BQ | SF | DB | SV |
DAY() | Returns the day component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
HOUR() | Returns the hour component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
MINUTE() | Returns the minute component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
MONTH() | Returns the month component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
QUARTER() | Returns the quarter component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
SECOND() | Returns the second component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
WEEK() | Returns the week component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
YEAR() | Returns the year component of a date or timestamp. | DD | PG | CH | TR | BQ | SF | DB | SV |
Truncation and formatting
| Function | Description | Backends |
|---|
DATE_TRUNC() | Returns the given date or timestamp truncated to the given unit. | DD | PG | CH | TR | BQ | SF | DB | SV |
DATE_FORMAT() | Returns a string from the given date or timestamp and format. | DD | PG | CH | TR | BQ | SF | DB | SV |
TO_ISO8601() | Returns an ISO 8601 string from the given timestamp or interval. | DD | PG | CH | TR | BQ | SF | DB | SV |
Parsing and construction
| Function | Description | Backends |
|---|
DATE_PARSE() | Returns a timestamp from the given string and format. | DD | PG | CH | TR | BQ | SF | DB | SV |
FROM_ISO8601_TIMESTAMP() | Returns a timestamp from the given ISO 8601 string. | DD | PG | CH | TR | BQ | SF | DB | SV |
MAKE_DATE() | Builds a DATE from its year, month and day, given as three arguments or as a ROW. | DD | PG | CH | TR | BQ | SF | DB | SV |
MAKE_TIMESTAMP() | Builds a TIMESTAMP from its calendar and clock components, given as six arguments or as a ROW. | DD | PG | CH | TR | BQ | SF | DB | SV |
Unix time conversion
| Function | Description | Backends |
|---|
FROM_UNIXTIME() | Returns a timestamp from the given unix timestamp (BIGINT representation of the number of seconds... | DD | PG | CH | TR | BQ | SF | DB | SV |
TO_UNIXTIME() | Returns a unix timestamp (DECIMAL seconds since 1970-01-01 00:00:00 UTC) from the given date or... | DD | PG | CH | TR | BQ | SF | DB | SV |
Timezone conversion
| Function | Description | Backends |
|---|
LOCAL_TO_UTC() | Converts a local clock time (TIMESTAMPTZ) in the given zone to a UTC TIMESTAMP. | DD | PG | CH | TR | BQ | SF | DB | SV |
UTC_TO_LOCAL() | Converts a UTC TIMESTAMP to the local clock time in the given timezone (TIMESTAMPTZ). | DD | PG | CH | TR | BQ | SF | DB | SV |
Interval operations
| Function | Description | Backends |
|---|
MAKE_INTERVAL() | Builds an INTERVAL from a ROW of duration components. | DD | PG | CH | TR | BQ | SF | DB | SV |
FROM_ISO8601_INTERVAL() | Returns an interval from the given ISO 8601 duration string. | DD | PG | CH | TR | BQ | SF | DB | SV |
INTERVAL_PARSE() | Returns an interval from the given duration string. | DD | PG | CH | TR | BQ | SF | DB | SV |
INTERVAL_TO_MS() | Returns the truncated number of milliseconds in the given interval. | DD | PG | CH | TR | BQ | SF | DB | SV |
UNSAFE_NATIVE() | Returns the value an INTERVAL is stored as on the backend, instead of its canonical text. | DD | PG | CH | TR | BQ | SF | DB | SV |
TO_ISO8601() | Returns an ISO 8601 duration string from the given interval. | DD | PG | CH | TR | BQ | SF | DB | SV |
MULTIPLY() | Scales an interval by an integer factor. | DD | PG | CH | TR | BQ | SF | DB | SV |
Summary
Functions in this category: 37