Parameters, Value
Time shift function returns the datetime value shifted from the original datetime value. The function shifts time according to parameter and it does not result in changing the value of parameters themselves.
Syntax:
- Format: date_add(
<date>
,<number>
, "<interval>
") - Parameters: see table below
- Value: ATTR (time)
Name | Type | Specification | Description |
---|---|---|---|
date | Datetime or timestamp | / | The original time value to shift |
number | Int | / | The time offset |
interval | String | Year, month, day, hour, minute, second, millisecond | The unit of the offset |
Constant
Example: return time value of the date 90 days later than "2022-04-30 22:12:54"
return date_add("2022-04-30 22:12:54", 90, "day")
Function
Example: return time value 5 hours earlier than current system time
return date_add(now(), -5, "hour")
Alias
Example: find 10 @transfer
edges, return transfer time as their eastern neighbor time zones'
find().edges({@transfer}) as e
limit 10
return date_add(e.time, 1, "hour")
Property
Example: find 10 @transfer
edges within a year till now
find().edges({date_add(@transfer.time, 1, "year") >= now()}) as e
limit 10
return e{*}
Compound Offset
Example:Defer the current system time for 3 days and shift earlier by 5 hours
update().edges({no == "TRX001"})
.set({time: date_add(date_add(time, 3, "day"), -5, "hour")}) as edges
return edges{*}