All functions > DATE AND TIME
All functions in the DATE AND TIME category.
Date/timestamp arithmetic
| Function | DuckDB | Trino | Serving | Description |
|---|
ADD() | ✓ | ✓ | ✓ | Returns the date/timestamp after adding an interval. |
DATE_ADD() | ✓ | ✓ | ✓ | Returns the date/timestamp after adding a given number of a given units to the given date or... |
SUBTRACT() | ✓ | ✓ | ✓ | Subtracts an interval from a timestamp or date, or returns the interval between two timestamps or... |
DATE_SUBTRACT() | ✓ | ✓ | ✓ | Returns the number of complete elapsed units in timestamp1 − timestamp2. Chaining-friendly: the... |
DATE_DIFF() | ✓ | ✓ | ✓ | Returns the number of calendar boundary crossings in timestamp1 − timestamp2. Same argument order... |
Calendar queries
| Function | DuckDB | Trino | Serving | Description |
|---|
FIRST_DAY_OF() | ✓ | ✓ | ✓ | Returns the first calendar day of the period containing the given date or timestamp, as midnight on... |
LAST_DAY_OF() | ✓ | ✓ | ✓ | Returns the last calendar day of the period containing the given date or timestamp, as midnight on... |
DAYS_IN() | ✓ | ✓ | ✓ | Returns the number of calendar days in the MONTH, QUARTER, HALF (half-year), or YEAR that contains... |
Sequence generation
| Function | DuckDB | Trino | Serving | Description |
|---|
SEQUENCE() | ✓ | ✓ | ✓ | Generates an inclusive array of dates or timestamps separated by an interval. |
DATE_SEQUENCE() | ✓ | ✓ | ✓ | Returns an array of timestamps: `count` values beginning at `start`, each separated by `interval`. |
Extraction
| Function | DuckDB | Trino | Serving | Description |
|---|
DATE_PART() | ✓ | ✓ | ✓ | Returns the part of the given timestamp in the given unit. |
Truncation and formatting
| Function | DuckDB | Trino | Serving | Description |
|---|
DATE_TRUNC() | ✓ | ✓ | ✓ | Returns the given date or timestamp truncated to the given unit. |
DATE_FORMAT() | ✓ | ✓ | ✓ | Returns a string from the given date or timestamp and format. |
TO_ISO8601() | ✓ | ✓ | ✓ | Returns an ISO 8601 string from the given timestamp or interval. |
Parsing and construction
| Function | DuckDB | Trino | Serving | Description |
|---|
DATE_PARSE() | ✓ | ✓ | ✓ | Returns a timestamp from the given string and format. |
FROM_ISO8601_TIMESTAMP() | ✓ | ✓ | ✓ | Returns a timestamp from the given ISO 8601 string. |
MAKE_DATE() | ✓ | ✓ | ✓ | Builds a DATE from a ROW of calendar components. |
MAKE_TIMESTAMP() | ✓ | ✓ | ✓ | Builds a TIMESTAMP from a ROW of calendar and clock components. |
Unix time conversion
| Function | DuckDB | Trino | Serving | Description |
|---|
FROM_UNIXTIME() | ✓ | ✓ | ✓ | Returns a timestamp from the given unix timestamp (BIGINT representation of the number of seconds... |
TO_UNIXTIME() | ✓ | ✓ | ✓ | Returns a unix timestamp (BIGINT representation of the number of seconds since 1970-01-01 00:00:00... |
Timezone conversion
| Function | DuckDB | Trino | Serving | Description |
|---|
LOCAL_TO_UTC() | ✓ | ✓ | ✓ | Treats a naive TIMESTAMP as local wall time in the given zone and returns the same instant as a... |
UTC_TO_LOCAL() | ✓ | ✓ | ✓ | Interprets a naive UTC TIMESTAMP as an instant and returns it in the given timezone (TIMESTAMPTZ). |
Interval operations
| Function | DuckDB | Trino | Serving | Description |
|---|
MAKE_INTERVAL() | ✓ | ✓ | ✓ | Builds an INTERVAL from a ROW of duration components. |
FROM_ISO8601_INTERVAL() | ✓ | ✓ | ✗ | Returns an interval from the given ISO 8601 duration string. |
INTERVAL_PARSE() | ✓ | ✓ | ✓ | Returns an interval from the given duration string. |
INTERVAL_TO_MS() | ✓ | ✓ | ✓ | Returns the truncated number of milliseconds in the given interval. |
TO_ISO8601() | ✓ | ✓ | ✓ | Returns an ISO 8601 duration string from the given interval. |
MULTIPLY() | ✓ | ✓ | ✓ | Scales an interval by an integer factor. |
Summary
Functions in this category: 28