Dates & time Scalar

epoch_ns()

Extract the epoch component in nanoseconds from a temporal type

Reference: DuckDB 1.3.2

Arguments & returns

7 overloads

epoch_ns(temporal)

Scalar
Overload link temporal Returns
#01 DATE BIGINT
#02 INTERVAL BIGINT
#03 TIME BIGINT
#04 TIME WITH TIME ZONE BIGINT
#05 TIMESTAMP BIGINT
#06 TIMESTAMP WITH TIME ZONE BIGINT
#07 TIMESTAMP_NS BIGINT

Example

epoch_ns example
SQL
Haybarn WASM 2.0.0-rc12 ยท In your browser

Engine example ยท Run to view results.

In other engines

Snowflakedatediff()

DATEDIFF(NANOSECOND, start_time, end_time)
In DuckDB
EPOCH_NS(CAST(end_time AS TIMESTAMP_NS)) - EPOCH_NS(CAST(start_time AS TIMESTAMP_NS))

SQLGlot example โ†—