- Categories:
Semi-structured and structured data functions (Type Predicates)
IS_DATE , IS_DATE_VALUE¶
Verifies whether a VARIANT value contains a DATE value.
IS_DATE and IS_DATE_VALUE are synonymous.
- See also:
Syntax¶
IS_DATE( <variant_expr> )
IS_DATE_VALUE( <variant_expr> )
Arguments¶
variant_expr
An expression that evaluates to a value of type VARIANT.
Returns¶
This function returns a value of type BOOLEAN.
Examples¶
Show all DATE values in a VARIANT column.
Note
The output format for date values is set using the DATE_OUTPUT_FORMAT parameter. The default setting is YYYY-MM-DD
.
Create and load the table:
CREATE OR REPLACE TABLE vardttm (v VARIANT);
INSERT INTO vardttm SELECT TO_VARIANT(TO_DATE('2024-02-24'));
INSERT INTO vardttm SELECT TO_VARIANT(TO_TIME('20:57:01.123456789+07:00'));
INSERT INTO vardttm SELECT TO_VARIANT(TO_TIMESTAMP('2023-02-24 12:00:00.456'));
INSERT INTO vardttm SELECT TO_VARIANT(TO_TIMESTAMP_LTZ('2022-02-24 13:00:00.123 +01:00'));
INSERT INTO vardttm SELECT TO_VARIANT(TO_TIMESTAMP_NTZ('2021-02-24 14:00:00.123 +01:00'));
INSERT INTO vardttm SELECT TO_VARIANT(TO_TIMESTAMP_TZ('2020-02-24 15:00:00.123 +01:00'));
Show the DATE values in the data:
SELECT * FROM vardttm WHERE IS_DATE(v);
+--------------+
| V |
|--------------|
| "2024-02-24" |
+--------------+