Skip to main content

unix_nanos function

Applies to: check marked yes Databricks Runtime 19 and above

Beta

This feature is in Beta.

Returns the number of nanoseconds since 1970-01-01 00:00:00 UTC.

To enable nanosecond-precision timestamps, see TIMESTAMP type.

Syntax​

unix_nanos(expr)

Arguments​

  • expr: A TIMESTAMP_LTZ(p) or TIMESTAMP_NTZ(p) expression, where p is from 7 through 9.

Returns​

A DECIMAL(21, 0).

Examples​

SQL
> SELECT unix_nanos(TIMESTAMP'1970-01-01 00:00:01.123456789Z');
1123456789