FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
TimeAdd
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
TimeAdd( base, offset, unit )
time_add( base, offset, unit )
TimeAdd( base, offset, unit )
TimeAdd( base, offset, unit )
TimeAdd( base, offset, unit )
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Timestamp or Date |
A timestamp or date to add to. |
|
Integer or Long |
The integer number of |
|
String |
Unit of the When When
|
Returns
When base
is a Date, a new Date which represents base
with offset
unit
s added to it.
When base
is a Timestamp, a new Timestamp which
represents base
with offset
unit
s added to it.
Examples
The following query returns a Timestamp representing one day after the Unix epoch:
Time("1970-01-02T00:00:00Z")
FaunaTime('1970-01-02T00:00:01Z')
{0 62135683201 <nil>}
FaunaTime(1970-01-02T00:00:00Z)
Time("1970-01-02T00:00:00Z")
The following query returns a Timestamp 5 seconds in the future from now:
[ Time("2019-10-22T16:45:19.223863Z"),
Time("2019-10-22T16:45:24.223863Z") ]
[FaunaTime('2021-01-18T22:04:09.121Z'), FaunaTime('2021-01-18T22:04:14.121Z')]
[{183000000 63746604242 <nil>} {183000000 63746604247 <nil>}]
Arr(FaunaTime(2019-10-22T16:45:15.23Z), FaunaTime(2019-10-22T16:45:20.23Z))
[ Time("2021-06-23T12:23:09.348Z"), Time("2021-06-23T12:23:14.348Z") ]
The following query returns a Date 1 day after 2019-11-26:
Date("2019-11-27")
2019-11-27
{0 63710409600 <nil>}
FaunaDate(2019-11-27 12:00:00 AM)
Date("2019-11-27")
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!