toUnixTime - Represent a timestamp as time units since Epoch
toUnixTime
converts a timestamp
to a number of specific time units since the UNIX epoch (in UTC). The UNIX epoch starts on January 1, 1970.
Note
Timestamps from before Epoch are represented by 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 be converted to a unix timestamp |
timeUnit | timeunit | false | The desired timeunit of the unix timestamp. Defaults to milli |
Example - Changing the unix timestamp for compatability
Consider the following document:
Most systems expect the Unix timestamp to be in seconds
. We can convert this using the toUnixTime
function:
This results in the following document:
Theme
Light