TO_DATE
Date function
Last updated
Date function
Last updated
TO_DATE converts a date represented by a character string to a DATE data type. (Redshift SQL Language Reference TO_DATE function)
This function is fully supported in Snowflake.
For more information about quoted identifiers in functions, .
The query SELECT TO_DATE('20010631', 'YYYYMMDD')
fails in Snowflake because June has only 30 days, and Snowflake's TO_DATE
does not adjust invalid dates automatically, unlike Redshift's TO_DATE
with is_strict
set to false, which would convert it to July 1. To avoid errors with invalid date strings, you can use TRY_TO_DATE
, which returns NULL
if the conversion fails. This allows for smoother query execution and easier identification of invalid dates.
SSC-FDM-RS0004: Invalid dates will cause errors in Snowflake.
SSC-EWI-PG0005: Date or time format is not supported in Snowflake.
SSC-FDM-0032: Parameter is not a literal value, transformation could not be fully applied