Categories:

Semi-structured and Structured Data Functions (Type Predicates)

IS_TIMESTAMP_*¶

Verifies whether a VARIANT value contains the respective TIMESTAMP value:

  • IS_TIMESTAMP_LTZ (value with local time zone).

  • IS_TIMESTAMP_NTZ (value with no time zone).

  • IS_TIMESTAMP_TZ (value with time zone).

See also:

IS_<object_type> , IS_DATE , IS_DATE_VALUE , IS_TIMESTAMP_*

Syntax¶

IS_TIMESTAMP_LTZ( <variant_expr> )

IS_TIMESTAMP_NTZ( <variant_expr> )

IS_TIMESTAMP_TZ( <variant_expr> )
Copy

Examples¶

Get all timestamp_ltz values in a variable column, output using the timezone specified for the session.

Note

The output format for timestamp_ltz values is set using the TIMESTAMP_LTZ_OUTPUT_FORMAT parameter. If not specified, the default is to use the TIMESTAMP_OUTPUT_FORMAT parameter setting. The default setting for this parameter is YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM.

In this example, the local time zone is US Pacific Standard Time (-08:00 relative to GMT/UCT).

Create and load the table:

create or replace table vardttm (v variant);
Copy
BEGIN WORK;
insert into vardttm select to_variant(to_date('2017-02-24'));
insert into vardttm select to_variant(to_time('20:57:01.123456789+07:00'));
insert into vardttm select to_variant(to_timestamp('2017-02-24 12:00:00.456'));
insert into vardttm select to_variant(to_timestamp_ltz('2017-02-24 13:00:00.123 +01:00'));
insert into vardttm select to_variant(to_timestamp_ntz('2017-02-24 14:00:00.123 +01:00'));
insert into vardttm select to_variant(to_timestamp_tz('2017-02-24 15:00:00.123 +01:00'));
COMMIT WORK;
Copy

Show the TIMESTAMP values in the data:

select * from vardttm where is_timestamp_ntz(v)
    order by 1;
+---------------------------+
| V                         |
|---------------------------|
| "2017-02-24 12:00:00.456" |
| "2017-02-24 14:00:00.123" |
+---------------------------+
Copy
select * from vardttm where is_timestamp_ltz(v);
+---------------------------------+
| V                               |
|---------------------------------|
| "2017-02-24 04:00:00.123 -0800" |
+---------------------------------+
Copy
select * from vardttm where is_timestamp_tz(v);
+---------------------------------+
| V                               |
|---------------------------------|
| "2017-02-24 15:00:00.123 +0100" |
+---------------------------------+
Copy