TimeAdd
Not available in this language yet.
Not available in this language yet.
TimeAdd( base, offset, unit )
TimeAdd( base, offset, unit )
Not available in this language yet.
Not available in this language yet.
TimeAdd( base, offset, unit )
Not available in this language yet.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
A timestamp or date to add to.
|
|
|
The number 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:
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
System.out.println(
client.query(
TimeAdd(Epoch(0, "second"), 1, Value("day"))
).get());
client.query(
q.TimeAdd(q.Epoch(0, 'second'), 1, 'day')
)
.then((ret) => console.log(ret))
Not available in this language yet.
Not available in this language yet.
println(Await.result(
client.query(
TimeAdd(Epoch(0, "second"), 1, "day")
),
5.seconds
))
Not available in this language yet.
1970-01-02T00:00:00Z
Time("1970-01-02T00:00:00Z")
1970-01-02T00:00:00Z
The following query returns a Timestamp 5 seconds in the future from now:
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
System.out.println(
client.query(
Arr(
Now(),
TimeAdd(Now(), 5, Value("seconds"))
)
).get());
client.query([
q.Now(),
q.TimeAdd(q.Now(), 5, 'seconds'),
])
.then((ret) => console.log(ret))
Not available in this language yet.
Not available in this language yet.
println(Await.result(
client.query(
Arr(
Now(),
TimeAdd(Now(), 5, "seconds")
)
),
5.seconds
))
Not available in this language yet.
[2019-10-22T16:45:19.223863Z, 2019-10-22T16:45:24.223863Z]
[ Time("2019-10-22T16:45:19.223863Z"),
Time("2019-10-22T16:45:24.223863Z") ]
[2019-10-22T16:45:19.223863Z, 2019-10-22T16:45:24.223863Z]
The following query returns a Date 1 day after 2019-11-26:
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
System.out.println(
client.query(
TimeAdd(Date("2019-11-26"), 1, Value("day"))
).get());
client.query(
q.TimeAdd(Date('2019-11-26'), 1, 'day')
)
.then((ret) => console.log(ret))
Not available in this language yet.
Not available in this language yet.
println(Await.result(
client.query(
TimeAdd(Date("2019-11-26"), 1, "day")
),
5.seconds
))
Not available in this language yet.
2019-11-27
Date("2019-11-27")
2019-11-27
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!