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
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