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

# Date and time functions

> Build, convert, format, extract from and do arithmetic on dates, times and timestamps.

Build, convert, format, extract from and do arithmetic on dates, times and timestamps.

| Function | Type | What it does |
| - | - | - |
| [`add_months`](/query/sql/functions/date-time/add_months) | Scalar | Adds signed calendar months and clamps to month end. |
| [`convert_timezone`](/query/sql/functions/date-time/convert_timezone) | Scalar | Converts a timestamp to another time zone or converts a local time between time zones. |
| [`curdate`](/query/sql/functions/date-time/curdate) | Scalar | Returns the current date in the session timezone, falling back to UTC. |
| [`current_date`](/query/sql/functions/date-time/current_date) | Scalar | Returns the current date in the session timezone, falling back to UTC. |
| [`current_timestamp`](/query/sql/functions/date-time/current_timestamp) | Scalar | Returns the query-start timestamp with microsecond precision. |
| [`current_timezone`](/query/sql/functions/date-time/current_timezone) | Scalar | Returns the session timezone string, using UTC when unset. |
| [`date`](/query/sql/functions/date-time/date) | Scalar | Converts a value to DATE, with the same behavior as CAST(value AS DATE). |
| [`date_add`](/query/sql/functions/date-time/date_add) | Scalar | Adds calendar days or specified temporal units. |
| [`date_diff`](/query/sql/functions/date-time/date_diff) | Scalar | Returns local date boundaries with two arguments or complete elapsed units with three arguments. |
| [`date_format`](/query/sql/functions/date-time/date_format) | Scalar | Formats a date or timestamp as a string. |
| [`date_part`](/query/sql/functions/date-time/date_part) | Scalar | Extracts a requested temporal component. |
| [`date_sub`](/query/sql/functions/date-time/date_sub) | Scalar | Subtracts a signed number of days from a date. |
| [`date_trunc`](/query/sql/functions/date-time/date_trunc) | Scalar | Truncates a timestamp to a chosen granularity. |
| [`dateadd`](/query/sql/functions/date-time/dateadd) | Scalar | Adds a specified number of units to a date or timestamp. |
| [`datediff`](/query/sql/functions/date-time/datediff) | Scalar | Returns local date boundaries with two arguments or complete elapsed units with three arguments. |
| [`datepart`](/query/sql/functions/date-time/datepart) | Scalar | Extracts a requested temporal component. |
| [`datetime`](/query/sql/functions/date-time/datetime) | Scalar | Sets a timestamp’s time zone without changing the instant it represents. |
| [`day`](/query/sql/functions/date-time/day) | Scalar | Extracts the day-of-month component. |
| [`dayname`](/query/sql/functions/date-time/dayname) | Scalar | Returns the three-letter English weekday name. |
| [`dayofweek`](/query/sql/functions/date-time/dayofweek) | Scalar | Extracts the Sunday-based weekday number from a date or timestamp. |
| [`dayofweekiso`](/query/sql/functions/date-time/dayofweekiso) | Being confirmed | Previous docs; being confirmed. |
| [`days`](/query/sql/functions/date-time/days) | Scalar | Extracts the day-of-month component. |
| [`extract`](/query/sql/functions/date-time/extract) | Scalar | Extracts an applicable calendar or clock component from a temporal value. |
| [`format_date`](/query/sql/functions/date-time/format_date) | Scalar | Formats a date as a string. |
| [`format_timestamp`](/query/sql/functions/date-time/format_timestamp) | Scalar | Formats a timestamp as a string. |
| [`from_unixtime`](/query/sql/functions/date-time/from_unixtime) | Scalar | Converts epoch seconds to a UTC timestamp or formatted string. |
| [`from_unixtime_withunit`](/query/sql/functions/date-time/from_unixtime_withunit) | Scalar | Converts an epoch value in seconds or milliseconds to a UTC timestamp. |
| [`from_utc_timestamp`](/query/sql/functions/date-time/from_utc_timestamp) | Scalar | Converts UTC wall time to the requested local wall time. |
| [`generate_date_array`](/query/sql/functions/date-time/generate_date_array) | Scalar | Generates an inclusive stepped array of dates. |
| [`generate_timestamp_array`](/query/sql/functions/date-time/generate_timestamp_array) | Scalar | Generates an inclusive stepped array of timestamps. |
| [`getdate`](/query/sql/functions/date-time/getdate) | Scalar | Returns the query-start timestamp with microsecond precision. |
| [`getutcdate`](/query/sql/functions/date-time/getutcdate) | Scalar | Returns the current UTC date. |
| [`hour`](/query/sql/functions/date-time/hour) | Scalar | Extracts the hour component. |
| [`last_day`](/query/sql/functions/date-time/last_day) | Scalar | Returns the last calendar date of the input month. |
| [`last_day_of_month`](/query/sql/functions/date-time/last_day_of_month) | Scalar | Returns the last calendar date of the input month. |
| [`make_date`](/query/sql/functions/date-time/make_date) | Scalar | Constructs a date from year, month and day. |
| [`make_time`](/query/sql/functions/date-time/make_time) | Scalar | Constructs a time with fractional-second precision. |
| [`make_timestamp`](/query/sql/functions/date-time/make_timestamp) | Scalar | Constructs a UTC timestamp from calendar and time components. |
| [`minute`](/query/sql/functions/date-time/minute) | Scalar | Extracts the minute component. |
| [`month`](/query/sql/functions/date-time/month) | Scalar | Extracts the month component. |
| [`monthname`](/query/sql/functions/date-time/monthname) | Scalar | Returns the three-letter English month name. |
| [`months_between`](/query/sql/functions/date-time/months_between) | Scalar | Returns a signed fractional month difference, first minus second. |
| [`next_day`](/query/sql/functions/date-time/next_day) | Scalar | Returns the next matching weekday strictly after the input date. |
| [`now`](/query/sql/functions/date-time/now) | Scalar | Returns the query-start timestamp with microsecond precision. |
| [`parse`](/query/sql/functions/date-time/parse) | Being confirmed | Previous docs; being confirmed. |
| [`parse_date`](/query/sql/functions/date-time/parse_date) | Being confirmed | Previous docs; being confirmed. |
| [`parse_datetime`](/query/sql/functions/date-time/parse_datetime) | Being confirmed | Previous docs; being confirmed. |
| [`parse_timestamp`](/query/sql/functions/date-time/parse_timestamp) | Scalar | Parses a formatted timestamp string and returns a UTC timestamp. |
| [`quarter`](/query/sql/functions/date-time/quarter) | Scalar | Extracts the calendar quarter from a date or timestamp. |
| [`second`](/query/sql/functions/date-time/second) | Scalar | Extracts the second component. |
| [`timestamp`](/query/sql/functions/date-time/timestamp) | Scalar | Constructs a UTC timestamp from string, date or timestamp input. |
| [`timestamp_add`](/query/sql/functions/date-time/timestamp_add) | Scalar | Adds a signed duration or calendar interval to a timestamp. |
| [`timestamp_diff`](/query/sql/functions/date-time/timestamp_diff) | Scalar | Returns complete elapsed units from start to end. |
| [`timestamp_micros`](/query/sql/functions/date-time/timestamp_micros) | Scalar | Converts Unix epoch microseconds to a UTC timestamp. |
| [`timestamp_millis`](/query/sql/functions/date-time/timestamp_millis) | Scalar | Converts Unix epoch milliseconds to a UTC timestamp. |
| [`timestamp_seconds`](/query/sql/functions/date-time/timestamp_seconds) | Scalar | Converts Unix epoch seconds to a UTC timestamp. |
| [`timestampadd`](/query/sql/functions/date-time/timestampadd) | Scalar | Adds a signed duration or calendar interval to a timestamp. |
| [`timestampdiff`](/query/sql/functions/date-time/timestampdiff) | Scalar | Returns complete elapsed units from start to end. |
| [`to_char`](/query/sql/functions/date-time/to_char) | Scalar | Formats a temporal, numeric, binary or string value as text. |
| [`to_date`](/query/sql/functions/date-time/to_date) | Scalar | Converts a value to a date. |
| [`to_time`](/query/sql/functions/date-time/to_time) | Scalar | Converts time text to a TIME value using a Spark-style format supplied for each row. |
| [`to_timestamp`](/query/sql/functions/date-time/to_timestamp) | Scalar | Converts a value to a timezone-bearing timestamp. |
| [`to_timestamp_ntz`](/query/sql/functions/date-time/to_timestamp_ntz) | Scalar | Converts a value to a timezone-free timestamp. |
| [`to_timestamp_tz`](/query/sql/functions/date-time/to_timestamp_tz) | Scalar | Converts a value to a timezone-bearing timestamp. |
| [`to_unix_timestamp`](/query/sql/functions/date-time/to_unix_timestamp) | Scalar | Returns epoch seconds from a timestamp or explicitly formatted string. |
| [`to_unixtime`](/query/sql/functions/date-time/to_unixtime) | Scalar | Returns the number of seconds since the Unix epoch for a timestamp. |
| [`to_utc_timestamp`](/query/sql/functions/date-time/to_utc_timestamp) | Scalar | Converts local wall time in a timezone to UTC wall time. |
| [`to_varchar`](/query/sql/functions/date-time/to_varchar) | Scalar | Formats a temporal, numeric, binary or string value as text. |
| [`trunc`](/query/sql/functions/date-time/trunc) | Scalar | Truncates a date or timestamp to the specified unit and returns a DATE. |
| [`try_to_date`](/query/sql/functions/date-time/try_to_date) | Scalar | Converts a date representation, returning NULL on parse failure. |
| [`try_to_timestamp`](/query/sql/functions/date-time/try_to_timestamp) | Scalar | Parses a value as a timestamp without a timezone, returning NULL on a failed supported conversion. |
| [`try_to_timestamp_ntz`](/query/sql/functions/date-time/try_to_timestamp_ntz) | Scalar | Parses a value as a timestamp without a timezone, returning NULL on a failed supported conversion. |
| [`unix_timestamp`](/query/sql/functions/date-time/unix_timestamp) | Scalar | Returns epoch seconds from a timestamp or explicitly formatted string. |
| [`week`](/query/sql/functions/date-time/week) | Being confirmed | Previous docs; being confirmed. |
| [`weekday`](/query/sql/functions/date-time/weekday) | Scalar | Returns the weekday number with Monday numbered zero. |
| [`weekiso`](/query/sql/functions/date-time/weekiso) | Being confirmed | Previous docs; being confirmed. |
| [`weekofyear`](/query/sql/functions/date-time/weekofyear) | Scalar | Extracts the ISO 8601 week number component. |
| [`year`](/query/sql/functions/date-time/year) | Scalar | Extracts the year component. |


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