toInterval
Description
Returns an interval created from a numeric value and an optional time unit.
This function works with integers, decimals, positive, and negative values.
Syntax
Like many functions in DataPrime, toInterval supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| number | number | true | The number to convert into an interval |
| timeUnit | timeunit | false | The time unit of the value. Defaults to nano |
Example
Use case: Add numeric duration to a timestamp to compute an end time
A log contains a start_time and a numeric duration in seconds. Convert the duration into an interval and add it to the timestamp.
Example query
Example output
Theme
Light