timestamp_nanos function
Applies to: Databricks Runtime 19 and above
Beta
This feature is in Beta.
Creates a timestamp from the number of nanoseconds in expr since the UTC epoch.
To enable nanosecond-precision timestamps, see TIMESTAMP type.
Syntax
timestamp_nanos(expr)
Arguments
expr: An integral orDECIMALexpression that specifies a number of nanoseconds. Fractional values are rounded down to the nearest integer.
Returns
A TIMESTAMP_LTZ(9).
If the nanosecond count is outside the range that a TIMESTAMP_LTZ(9) can represent, the function raises DATETIME_OVERFLOW.
Common error conditions
Examples
SQL
> SELECT timestamp_nanos(1230219000123456789);
2008-12-25 07:30:00.123456789