Aller au contenu principal

to_timestamp_ntz function

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

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

Syntax​

to_timestamp_ntz(expr [, fmt] )

Arguments​

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

Returns​

A TIMESTAMP_NTZ.

If you omit fmt, the function is a synonym for cast(expr AS TIMESTAMP_NTZ).

If fmt is malformed or doesn't produce a well-formed timestamp, Databricks raises an error.

Common error conditions​

Examples​

SQL
> SELECT to_timestamp_ntz('2016-12-31 00:12:00');
2016-12-31 00:12:00

> SELECT to_timestamp_ntz('2016-12-31', 'yyyy-MM-dd');
2016-12-31 00:00:00