A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/as_timestamp below:

Website Navigation


AS_TIMESTAMP_* | Snowflake Documentation

Categories:

Semi-structured and structured data functions (Cast)

AS_TIMESTAMP_*

Casts a VARIANT value to the respective timestamp value:

See also:

AS_<object_type> , AS_DATE , AS_TIME

Syntax
AS_TIMESTAMP_LTZ( <variant_expr> )

AS_TIMESTAMP_NTZ( <variant_expr> )

AS_TIMESTAMP_TZ( <variant_expr> )

Copy

Arguments
variant_expr

An expression that evaluates to a value of type VARIANT.

Returns

The function returns a value of a timestamp type or NULL:

Examples

Create a table and load data into it:

CREATE OR REPLACE TABLE as_timestamp_example (timestamp1 VARIANT);

INSERT INTO as_timestamp_example (timestamp1)
  SELECT TO_VARIANT(TO_TIMESTAMP_NTZ('2024-10-10 12:34:56'));

Copy

Use the AS_TIMESTAMP_NTZ function in a query to cast a VARIANT value to a TIMESTAMP_NTZ value:

SELECT AS_TIMESTAMP_NTZ(timestamp1) AS timestamp_value
  FROM as_timestamp_example;

Copy

+-------------------------+
| TIMESTAMP_VALUE         |
|-------------------------|
| 2024-10-10 12:34:56.000 |
+-------------------------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4