メインコンテンツまでスキップ

to_timestamp_ltz function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns expr cast to a timestamp with a local time zone using optional formatting.

Syntax​

to_timestamp_ltz(expr [, fmt] )

Arguments​

  • expr: A STRING, DATE, TIMESTAMP, or numeric expression that represents a timestamp.
  • fmt: An optional format STRING expression.

Returns​

A TIMESTAMP_LTZ.

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, Databricks raises an error.

Common error conditions​

Examples​

SQL
> 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