unix_nanos function
Applies to: 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: ATIMESTAMP_LTZ(p)orTIMESTAMP_NTZ(p)expression, wherepis from7through9.
Returns
A DECIMAL(21, 0).
Examples
SQL
> SELECT unix_nanos(TIMESTAMP'1970-01-01 00:00:01.123456789Z');
1123456789