TIMESTAMP_FROM_PARTS

functionsupportedCore SQL functions

docs.snowflake.com ↗

Date & time functions

Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.

Syntax

supportedpartialnot supportednot scored

TIMESTAMP_FROM_PARTS( <year>, <month>, <day>, <hour>, <minute>, <second> [, <nanosecond> ] [, <time_zone> ] )

TIMESTAMP_FROM_PARTS( <date_expr>, <time_expr> )
TIMESTAMP_LTZ_FROM_PARTS( <year>, <month>, <day>, <hour>, <minute>, <second> [, <nanosecond>] )
TIMESTAMP_NTZ_FROM_PARTS( <year>, <month>, <day>, <hour>, <minute>, <second> [, <nanosecond>] )

TIMESTAMP_NTZ_FROM_PARTS( <date_expr>, <time_expr> )
TIMESTAMP_TZ_FROM_PARTS( <year>, <month>, <day>, <hour>, <minute>, <second> [, <nanosecond>] [, <time_zone>] )

Parameters

NameRequiredDescription
yearrequiredAn integer expression to use as a year for building a timestamp.
monthrequiredAn integer expression to use as a month for building a timestamp, with January represented as 1, and December as 12.
dayrequiredAn integer expression to use as a day for building a timestamp, usually in the 1-31 range.
hourrequiredAn integer expression to use as an hour for building a timestamp, usually in the 0-23 range.
minuterequiredAn integer expression to use as a minute for building a timestamp, usually in the 0-59 range.
secondrequiredAn integer expression to use as a second for building a timestamp, usually in the 0-59 range.
date_expr , time_exprrequiredSpecifies the date and time expressions to use for building a timestamp where date_expr provides the year, month, and day for the timestamp and time_expr provides the hour, minute, second, and nanoseconds within the day. Only valid for: TIMESTAMP_FROM_PARTS (when the TIMESTAMP_TYPE_MAPPING session parameter is set to TIMESTAMP_NTZ) TIMESTAMP_NTZ_FROM_PARTS
nanosecondsoptionalAn integer expression to use as a nanosecond for building a timestamp, usually in the 0-999999999 range.
time_zoneoptionalA string expression to use as a time zone for building a timestamp (e.g. America/Los_Angeles). Only valid for: TIMESTAMP_FROM_PARTS (when the TIMESTAMP_TYPE_MAPPING session parameter is set to TIMESTAMP_TZ) TIMESTAMP_TZ_FROM_PARTS

Usage notes