Overview
The dateAdd()
function adds a specified time interval to a given time and returns the result.
Syntax
dateAdd(time, interval, unit)
Augment |
Type |
Description |
---|---|---|
time |
Datetime, timestamp, string | The orginal time |
interval |
Integer | The value of time interval to add |
unit |
string | The unit of the interval , which can be set as year , month , day , hour , minute , or second |
Return type: Datetime
Example of Result
return dateAdd("1970-01-01 10:00:00", -1, "hour")
Result: 1970-01-01 09:00:00
Example of Use
Extend all memberships by 3 days and 12 hours.
update().nodes({@membership}).set({
expiry: dateAdd(dateAdd(expiry, 3, "day"), 12, "hour")
})