Applies to: Databricks SQL Databricks Runtime
expr cast to a date using an optional formatting.
expr: A STRING expression representing a date.
fmt: An optional format STRING expression.
fmt is supplied, it must conform with Datetime patterns.
fmt is not supplied, the function is a synonym for
cast(expr AS DATE).
fmt is malformed or its application does not result in a well formed date, the function raises an error.
In Databricks Runtime, if spark.sql.ansi.enabled is
false, the function returns
NULL instead of an error for malformed dates.