duration
duration(end_timestamp: numeric or variant) -> duration
duration(start_timestamp: timestamp, end_timestamp: timestamp) -> duration
Convert one argument as a number of nanoseconds or a timestamp, or two arguments as start or stop timestamps, to a duration. Numbers are input in nanoseconds.
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
make_col fromTime:parse_isotime("2022-04-20T16:20:00Z"), toTime:parse_isotime("2022-04-20T16:20:02")
make_col dur:duration(fromTime, toTime)
Creates two columns fromTime and toTime as parsed time stamps, and then calculates the duration between these two timestamps into dur.
In this case, the duration will be 2 seconds. Note that the start time is the first argument.
make_col someNanos:123000
make_col dur:duration(someNanos)
Creates the column someNanos that contains the integer value 123000.
Converts this as number of nanoseconds to the duration column dur. The duration will be 123 microseconds.
Updated 8 days ago