> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Date and timestamp functions

> Spark date and timestamp functions supported in SparkSQL and Databricks compatibility modes.

Preview

Spark [date and timestamp functions](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#date-and-timestamp-functions) in [SparkSQL and Databricks compatibility modes](https://docs.firebolt.io/reference-sql/spark/overview.md). Both modes share these functions. Support is one of: Supported, With limitations, or Not supported. Supported means every example in the Spark reference returns what Spark returns; a note under With limitations quotes a call that differs.

| Function | Support | Notes |
| :- | :- | :- |
| [`ADD_MONTHS`](https://spark.apache.org/docs/4.1.0/api/sql/#add_months) | Supported | |
| [`CURDATE`](https://spark.apache.org/docs/4.1.0/api/sql/#curdate) | Supported | |
| [`CURRENT_DATE`](https://spark.apache.org/docs/4.1.0/api/sql/#current_date) | Supported | |
| [`CURRENT_TIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#current_timestamp) | Supported | |
| [`CURRENT_TIMEZONE`](https://spark.apache.org/docs/4.1.0/api/sql/#current_timezone) | Supported | |
| [`DATE_ADD`](https://spark.apache.org/docs/4.1.0/api/sql/#date_add) | Supported | |
| [`DATE_SUB`](https://spark.apache.org/docs/4.1.0/api/sql/#date_sub) | Supported | |
| [`DAY`](https://spark.apache.org/docs/4.1.0/api/sql/#day) | Supported | |
| [`DAYNAME`](https://spark.apache.org/docs/4.1.0/api/sql/#dayname) | Supported | |
| [`DAYOFMONTH`](https://spark.apache.org/docs/4.1.0/api/sql/#dayofmonth) | Supported | |
| [`DAYOFWEEK`](https://spark.apache.org/docs/4.1.0/api/sql/#dayofweek) | Supported | |
| [`DAYOFYEAR`](https://spark.apache.org/docs/4.1.0/api/sql/#dayofyear) | Supported | |
| [`FROM_UTC_TIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#from_utc_timestamp) | Supported | |
| [`HOUR`](https://spark.apache.org/docs/4.1.0/api/sql/#hour) | Supported | |
| [`LOCALTIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#localtimestamp) | Supported | |
| [`MAKE_DATE`](https://spark.apache.org/docs/4.1.0/api/sql/#make_date) | Supported | |
| [`MINUTE`](https://spark.apache.org/docs/4.1.0/api/sql/#minute) | Supported | |
| [`MONTH`](https://spark.apache.org/docs/4.1.0/api/sql/#month) | Supported | |
| [`MONTHNAME`](https://spark.apache.org/docs/4.1.0/api/sql/#monthname) | Supported | |
| [`NOW`](https://spark.apache.org/docs/4.1.0/api/sql/#now) | Supported | |
| [`QUARTER`](https://spark.apache.org/docs/4.1.0/api/sql/#quarter) | Supported | |
| [`SECOND`](https://spark.apache.org/docs/4.1.0/api/sql/#second) | Supported | |
| [`TIMESTAMP_SECONDS`](https://spark.apache.org/docs/4.1.0/api/sql/#timestamp_seconds) | Supported | |
| [`TO_DATE`](https://spark.apache.org/docs/4.1.0/api/sql/#to_date) | Supported | |
| [`TO_TIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#to_timestamp) | Supported | |
| [`TO_UTC_TIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#to_utc_timestamp) | Supported | |
| [`WEEKDAY`](https://spark.apache.org/docs/4.1.0/api/sql/#weekday) | Supported | |
| [`WEEKOFYEAR`](https://spark.apache.org/docs/4.1.0/api/sql/#weekofyear) | Supported | |
| [`YEAR`](https://spark.apache.org/docs/4.1.0/api/sql/#year) | Supported | |
| [`DATE_DIFF`](https://spark.apache.org/docs/4.1.0/api/sql/#date_diff) | With limitations | String arguments are not supported; pass `DATE` values. |
| [`DATE_FORMAT`](https://spark.apache.org/docs/4.1.0/api/sql/#date_format) | With limitations | The pattern must be a constant. Some pattern fields, such as the time zone names `z` and `VV`, are not supported. |
| [`DATE_PART`](https://spark.apache.org/docs/4.1.0/api/sql/#date_part) | With limitations | Returns `NUMERIC(38, 9)`, where Spark returns `NUMERIC(8, 6)`. |
| [`DATE_TRUNC`](https://spark.apache.org/docs/4.1.0/api/sql/#date_trunc) | With limitations | A string timestamp raises an error; pass a `TIMESTAMP` or `DATE`, as in `date_trunc('YEAR', TIMESTAMP'2015-03-05 09:32:05')`. |
| [`DATEDIFF`](https://spark.apache.org/docs/4.1.0/api/sql/#datediff) | With limitations | Returns `BIGINT`, where Spark returns `INTEGER`. |
| [`DATEPART`](https://spark.apache.org/docs/4.1.0/api/sql/#datepart) | With limitations | Returns `NUMERIC(38, 9)`, where Spark returns `NUMERIC(8, 6)`. |
| [`EXTRACT`](https://spark.apache.org/docs/4.1.0/api/sql/#extract) | With limitations | Returns `NUMERIC(38, 9)`, where Spark returns `NUMERIC(8, 6)`. |
| [`FROM_UNIXTIME`](https://spark.apache.org/docs/4.1.0/api/sql/#from_unixtime) | With limitations | Some argument forms are not supported. |
| [`MAKE_DT_INTERVAL`](https://spark.apache.org/docs/4.1.0/api/sql/#make_dt_interval) | With limitations | `make_dt_interval(1, 12, 30, 01.001001)` returns `'1 day 12:30:01.001001'`, where Spark returns `'1 12:30:01.001001 DAY TO SECOND'`. |
| [`MAKE_INTERVAL`](https://spark.apache.org/docs/4.1.0/api/sql/#make_interval) | With limitations | The interval renders in Firebolt's format, such as `1 mon 1 day 00:01:40.000001`, not Spark's. |
| [`MAKE_TIMESTAMP`](https://spark.apache.org/docs/4.1.0/api/sql/#make_timestamp) | With limitations | `make_timestamp(DATE'2014-12-28')` is not supported. |
| [`MAKE_TIMESTAMP_LTZ`](https://spark.apache.org/docs/4.1.0/api/sql/#make_timestamp_ltz) | With limitations | `make_timestamp_ltz(DATE'2014-12-28', TIME'6:30:45.887')` is not supported. |
| [`MAKE_TIMESTAMP_NTZ`](https://spark.apache.org/docs/4.1.0/api/sql/#make_timestamp_ntz) | With limitations | `make_timestamp_ntz(DATE'2014-12-28', TIME'6:30:45.887')` is not supported. |
| [`MAKE_YM_INTERVAL`](https://spark.apache.org/docs/4.1.0/api/sql/#make_ym_interval) | With limitations | `make_ym_interval(1, 2)` returns `'1 year 2 mons'`, where Spark returns `'1-2 YEAR TO MONTH'`. |
| [`TRUNC`](https://spark.apache.org/docs/4.1.0/api/sql/#trunc) | With limitations | A string date raises an error; pass a `DATE`, as in `trunc(DATE'2019-08-04', 'MM')`. |
| `CONVERT_TIMEZONE`, `CURRENT_TIME`, `DATE_FROM_UNIX_DATE`, `DATEADD`, `LAST_DAY`, `MAKE_TIME`, `MONTHS_BETWEEN`, `NEXT_DAY`, `SESSION_WINDOW`, `TIME_DIFF`, `TIME_TRUNC`, `TIMESTAMP_MICROS`, `TIMESTAMP_MILLIS`, `TO_TIME`, `TO_TIMESTAMP_LTZ`, `TO_TIMESTAMP_NTZ`, `TO_UNIX_TIMESTAMP`, `TRY_MAKE_INTERVAL`, `TRY_MAKE_TIMESTAMP`, `TRY_MAKE_TIMESTAMP_LTZ`, `TRY_MAKE_TIMESTAMP_NTZ`, `TRY_TO_DATE`, `TRY_TO_TIME`, `TRY_TO_TIMESTAMP`, `UNIX_DATE`, `UNIX_MICROS`, `UNIX_MILLIS`, `UNIX_SECONDS`, `UNIX_TIMESTAMP`, `WINDOW`, `WINDOW_TIME` | Not supported | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.