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 transaction’s start time. Multiple references to now within the same transaction produce the same timestamp. The transaction’s start time is the same on all nodes that participate in the transaction. During a temporal query, now still means the transaction’s start time, not the temporal query’s specified timestamp.

Use of now is deprecated. Use Now instead.

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!