Skip to main content

Date and time functions

CURRENT_DATE

Returns the current date.

CURRENT_TIMESTAMP

Returns the current timestamp.

DATE_ADD

Adds days to a date.

DATE_SUB

Subtracts days from a date.

DATEDIFF

Returns the number of days between two dates.

DATE_TRUNC

Truncates a timestamp to a specified precision.
Supported units: year, month, day, hour, minute, second

EXTRACT

Extracts a component from a date or timestamp.
Supported parts: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, DAYOFWEEK, DAYOFYEAR

TO_DATE

Converts a string to a date.

TO_TIMESTAMP

Converts a string to a timestamp.

FROM_UNIXTIME

Converts Unix epoch seconds to timestamp.

UNIX_TIMESTAMP

Converts a timestamp to Unix epoch seconds.

FORMAT_TIMESTAMP

Formats a timestamp column using a specified pattern string. Returns the formatted timestamp as a string.
Common patterns:
  • YYYY-MM-DD — Date only (2024-01-15)
  • HH24:MI:SS — 24-hour time (14:30:00)
  • YYYY-MM-DDTHH24:MI:SS — ISO 8601 without timezone
  • YYYY-MM-DDTHH24:MI:SS TZH:TZM — ISO 8601 with full timezone offset
See Snowflake date/time format elements for all supported pattern elements.

Numeric Functions

Math and rounding

String Functions

Text manipulation

All Functions

Browse all function categories

Data Types

DATE and TIMESTAMP type reference