toUnixTime
Description
Returns the number of time units since the Unix epoch (1970-01-01T00:00:00Z
) for a given timestamp.
Note
Timestamps before the epoch are represented as negative numbers.
Syntax
Like many functions in DataPrime, toUnixTime
supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
Name | Type | Required | Description |
---|---|---|---|
timestamp | timestamp | true | The timestamp to convert |
timeUnit | timeunit | false | The unit for the result. Defaults to milli |
Example
Use case: Convert a nanosecond timestamp into seconds for system compatibility
A log contains a timestamp in nanoseconds. Convert it to seconds to match external system requirements.
Output
Theme
Light