Time

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

Description

The Time function constructs a Timestamp, either from the string now, or 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

The string now, or an ISO 8601 date/time formatted string.

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)
println(Await.result(
  client.query(Time("1970-01-01T00:00:00+00:00")),
  5.seconds
))
result = client.query(q.time("1970-01-01T00:00:00+00:00"))
print(result)
puts $client.query {
  time '1970-01-01T00:00:00+00:00'
}
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>}
1970-01-01T00:00:00Z
FaunaTime('1970-01-01T00:00:00Z')
1970-01-01 00:00:00 UTC
{ "@ts": "1970-01-01T00:00:00Z" }
Time("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!