addTime
Description
Returns a new timestamp by adding an interval to an existing timestamp.
Both timestamp
and interval
are first-class types in DataPrime, so ensure that the correct types are passed.
Note
Negative intervals are supported and act as subtraction. For example, adding -1h
to a timestamp subtracts one hour.
Syntax
Like many functions in DataPrime, addTime
supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
Name | Type | Required | Description |
---|---|---|---|
t | timestamp | true | The base timestamp to modify |
i | interval | true | The interval to add (or subtract, if negative) |
Example
Use case: Compute an event’s end time from its start time and duration
A log contains a start_timestamp
field and a duration
field in seconds. Convert the duration to an interval, then add it to the start time to calculate the event's end_timestamp
.
Output
Theme
Light