Epoch

Copied!
( num, unit )

Description

The Epoch function constructs a Timestamp relative to the Unix epoch (1970-01-01T00:00:00Z).

The num argument must be an integer value. The unit argument specifies the scale of num.

Parameters

Parameter Type Definition and Requirements

num

A mathematical integer value specifying the offset from epoch.

unit

Indicates the units used by num. Must be one of:

  • day, or days

  • half day, or half days

  • hour, or hours

  • minute, or minutes

  • second, or seconds

  • millisecond, or milliseconds

  • microsecond, or microseconds

  • nanosecond, or nanoseconds

Returns

A Timestamp which represents Unix epoch plus the offset represented by num and unit.

Examples

The following query adds 0 seconds to the Unix epoch (1970-01-01T00:00:00Z) and returns a timestamp:

Copied!
(0, 'second')
("1970-01-01T00:00:00Z")
Query metrics:
  •    bytesIn:  27

  •   bytesOut:  43

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 3ms

  •    retries:   0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!