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

Website Navigation


AS_DATE | Snowflake Documentation

Categories:

Semi-structured and structured data functions (Cast)

AS_DATE

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

See also:

AS_<object_type>

Syntax
AS_DATE( <variant_expr> )

Copy

Arguments
variant_expr

An expression that evaluates to a value of type VARIANT.

Returns

The function returns a value of type DATE or NULL:

Examples

Create a table and load data into it:

CREATE OR REPLACE TABLE as_date_example (date1 VARIANT);

INSERT INTO as_date_example (date1)
 SELECT TO_VARIANT(TO_DATE('2024-10-10'));

Copy

Use the AS_DATE function in a query to cast a VARIANT value to a DATE value:

SELECT AS_DATE(date1) date_value
  FROM as_date_example;

Copy

+------------+
| DATE_VALUE |
|------------|
| 2024-10-10 |
+------------+

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