Time

Time( str )
Time( str )
Time( str )
Time( str )
Time( str )
Time str
Time( str )
Time( str )

Description

The Time function constructs a Timestamp from an ISO 8601 string. The special string now may be used to construct a time from the current request’s transaction time. Multiple references to now within the same transaction produce the same timestamp. The current transaction time is the same on all nodes that participate in the transaction. When doing a temporal query, now means the current time of the query, not the current time.

Parameters

Argument Type Definition and Requirements

str

An ISO 8601 date/time formatted string, or the string now.

Returns

A Timestamp which represents the converted string.

Examples

The query below returns a Timestamp constructed from the provided string.

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "time": "1970-01-01T00:00:00+00:00" }'
client.Query(Time("1970-01-01T00:00:00+00:00"));
System.out.println(
     client.query(Time(Value("1970-01-01T00:00:00+00:00"))
     ).get());
result, _ := client.Query(f.Time("1970-01-01T00:00:00+00:00"))

fmt.Println(result)
client.query(Time("1970-01-01T00:00:00+00:00"))
client.query(q.time("1970-01-01T00:00:00+00:00"))
$client.query do
  time '1970-01-01T00:00:00+00:00'
end
client.query(Time(fromString: "1970-01-01T00:00:00+00:00"))
client.query(q.Time("1970-01-01T00:00:00+00:00"))
  .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!