Epoch
Epoch( num, unit )
Epoch( num, unit )
Epoch( num, unit )
Epoch( num, unit )
epoch(0, unit )
epoch num, unit
Epoch( num, unit )
Epoch( 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
Argument | Type | Definition and Requirements |
---|---|---|
|
A mathematical integer value specifying the offset from epoch. |
|
|
Indicates the units used by
|
Examples
The following query adds 0 seconds to the Unix epoch (1970-01-01T00:00:00Z) and returns a timestamp:
curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "epoch": 0, "unit": "second" }'
client.Query(Epoch(0, "second"));
System.out.println(
client.query(Epoch(Value(0), TimeUnit.SECOND))
.get());
result, _ := client.Query(f.Epoch(0, f.TimeUnitSecond))
fmt.Println(result)
client.query(Epoch(0, "second"))
client.query(q.epoch(0, "second"))
$client.query do
epoch 0, 'second'
end
client.query(Epoch(0, "second"))
client.query(q.Epoch(0, 'second'))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": { "@ts": "1970-01-01T00:00:00Z" } }
{ "@ts": "1970-01-01T00:00:00Z" }
1970-01-01T00:00:00Z
{0 62135596800 <nil>}
{ "@ts": "1970-01-01T00:00:00Z" }
{ "@ts": "1970-01-01T00:00:00Z" }
{ "@ts": "1970-01-01T00:00:00Z" }
{ "@ts": "1970-01-01T00:00:00Z" }
FaunaTime { value: '1970-01-01T00:00:00Z' }
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!