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_time below:

Website Navigation


AS_TIME | Snowflake Documentation

Categories:

Semi-structured and structured data functions (Cast)

AS_TIME

Casts a VARIANT value to a TIME value. This function does not convert values of other data types, including timestamps, to TIME values.

See also:

AS_<object_type>

AS_DATE , AS_TIMESTAMP_*

Syntax
AS_TIME( <variant_expr> )

Copy

Arguments
variant_expr

An expression that evaluates to a value of type VARIANT.

Returns

The function returns a value of type TIME or NULL:

Examples

Create a table and load data into it:

CREATE OR REPLACE TABLE as_time_example (time1 VARIANT);

INSERT INTO as_time_example (time1)
  SELECT TO_VARIANT(TO_TIME('12:34:56'));

Copy

Use the AS_TIME function in a query to cast a VARIANT value to a TIME value:

SELECT AS_TIME(time1) AS time_value
  FROM as_time_example;

Copy

+------------+
| TIME_VALUE |
|------------|
| 12:34:56   |
+------------+

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