Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime
Returns expr cast to a timestamp with a local time zone using optional formatting.
Syntax
to_timestamp_ltz(expr [, fmt] )
Arguments
expr: ASTRING,DATE,TIMESTAMP, or numeric expression that represents a timestamp.- fmt: An optional format
STRINGexpression.
Returns
If you omit fmt, the function is a synonym for cast(expr AS TIMESTAMP_LTZ).
If fmt is malformed or doesn't produce a well-formed timestamp, Azure Databricks raises an error.
Common error conditions
Examples
> SELECT to_timestamp_ltz('2016-12-31 00:12:00');
2016-12-31 00:12:00
> SELECT to_timestamp_ltz('2016-12-31', 'yyyy-MM-dd');
2016-12-31 00:00:00