Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now GA. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. Migrating from v3 of the CLI? See the CLI migration guide. |
Time()
Description
Parameter fields:
Time field | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
|
Four-digit year. |
||||||||
|
Month, from |
||||||||
|
Day, from |
||||||||
|
Date and time separator. |
||||||||
|
Hours, from |
||||||||
|
Minutes, from |
||||||||
|
Seconds, from |
||||||||
|
Timezone offset from UTC which can be one of:
|
This method is equivalent to Time.fromString()
.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
time |
true |
Timestamp string in the form |
Examples
Time("2099-10-20T21:15:09.890729Z")
Time("2099-10-20T21:15:09.890729Z")
Test if a document timestamp is equal to a given time:
Customer.where(.ts == Time("2099-06-25T20:23:49.070Z"))
{
data: [
{
id: "111",
coll: Customer,
ts: Time("2099-06-25T20:23:49.070Z"),
cart: Order("412483941752112205"),
orders: "hdW...",
name: "Alice Appleseed",
email: "alice.appleseed@example.com",
address: {
street: "87856 Mendota Court",
city: "Washington",
state: "DC",
postalCode: "20220",
country: "US"
}
},
...
]
}
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!