
Use this only with HH12 ( not with HH24).įractional seconds with precision 0 (seconds) to 9 (nanoseconds), e.g. You can specify AM / PM.Īnte meridiem (am) / post meridiem (pm). when set to 1980, values of 79 and 80 parsed as 20 respectively. Two-digit year, controlled by the TWO_DIGIT_CENTURY_START session parameter, e.g. When specifying theįormat, you can use the case-insensitive elements listed in the following table: Specify the date and time format manually. Supported Formats for AUTO Detection for the formats that Snowflake recognizes whenĬonfigured to detect the format automatically. First, use TIMESTAMP (mapped to TIMESTAMP_NTZ) ALTER SESSION SET TIMESTAMP_TYPE_MAPPING = TIMESTAMP_NTZ CREATE OR REPLACE TABLE ts_test ( ts TIMESTAMP ) DESC TABLE ts_test + -+-+-+-+-+-+-+-+-+-+ | name | type | kind | null? | default | primary key | unique key | check | expression | comment | |-+-+-+-+-+-+-+-+-+-| | TS | TIMESTAMP_NTZ(9) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | + -+-+-+-+-+-+-+-+-+-+ - Next, explicitly use one of the TIMESTAMP variations (TIMESTAMP_LTZ) CREATE OR REPLACE TABLE ts_test ( ts TIMESTAMP_LTZ ) DESC TABLE ts_test + -+-+-+-+-+-+-+-+-+-+ | name | type | kind | null? | default | primary key | unique key | check | expression | comment | |-+-+-+-+-+-+-+-+-+-| | TS | TIMESTAMP_LTZ(9) | COLUMN | Y | NULL | N | N | NULL | NULL | NULL | + -+-+-+-+-+-+-+-+-+-+ĬREATE OR REPLACE TABLE ts_test ( ts timestamp_tz ) ALTER SESSION SET TIMEZONE = 'America/Los_Angeles' INSERT INTO ts_test values ( ' 16:00:00' ) INSERT INTO ts_test values ( ' 16:00:00 +00:00' ) - Note that the January 1st record inherited the session time zone, - and "America/Los_Angeles" was converted into a numeric time zone offset SELECT ts, hour ( ts ) FROM ts_test + -+-+ | TS | HOUR(TS) | |-+-| | Wed, 16:00:00 -0800 | 16 | | Thu, 16:00:00 +0000 | 16 | + -+-+ - Next, note that changing the session time zone does not influence the results ALTER SESSION SET TIMEZONE = 'America/New_York' SELECT ts, hour ( ts ) FROM ts_test + -+-+ | TS | HOUR(TS) | |-+-| | Wed, 16:00:00 -0800 | 16 | | Thu, 16:00:00 +0000 | 16 | + -+-+Īll of these data types accept most reasonable non-ambiguous date, time, or date + time formats. For example, the following comparison betweenĭifferent times in different timezones returns TRUE because the two values have equivalent times in UTC. TIMESTAMP_TZ values are compared based on their times in UTC.

Operations are performed with the time zone offset specific to each record. When a time zone is not provided, the session time zone offset is used. TIMESTAMP_TZ internally stores UTC time together with an associated time zone offset. TIMESTAMP_NTZ is the default for TIMESTAMP. If the output format contains a time zone, the UTC indicator ( Z) is displayed. All operations are performed without taking any time zone into account. TIMESTAMP_NTZ internally stores “wallclock” time with a specified precision. However, all operations are performed in the current session’s time zone, controlled by the

TIMESTAMP_LTZ internally stores UTC time with a specified precision.

Snowflake supports three variations of timestamp. TIMESTAMP_LTZ, TIMESTAMP_NTZ, TIMESTAMP_TZ ¶
