apoc.date.add
Function APOC Core
apoc.date.add(12345, 'ms', -365, 'd') - given a timestamp in one time unit, adds a value of the specified time unit
Signature
apoc.date.add(time :: INTEGER?, unit :: STRING?, addValue :: INTEGER?, addUnit :: STRING?) :: (INTEGER?)Input parameters
| Name | Type | Default | 
|---|---|---|
| time | INTEGER? | null | 
| unit | STRING? | null | 
| addValue | INTEGER? | null | 
| addUnit | STRING? | null | 
Usage Examples
| The  
 The computed value will be in the unit specified by the  | 
The following adds 10,000 milliseconds to the current datetime:
WITH apoc.date.add(datetime().epochMillis, "ms", 10000, "ms") AS output
RETURN outputinMs, datetime({epochMillis: output}) AS datetime;| outputinMs | datetime | 
|---|---|
| 1604509597386 | 2020-11-04T17:06:37.386Z | 
The following adds 1 day to the current datetime:
WITH apoc.date.add(datetime().epochMillis, "ms", 1, "day") AS output
RETURN outputinMs, datetime({epochMillis: output}) AS datetime;| outputinMs | datetime | 
|---|---|
| 1604596506209 | 2020-11-05T17:15:06.209Z | 
The following adds 1 hour to 12 hours:
RETURN apoc.date.add(12, "hour", 1, "hour") AS outputinHours| outputinHours | 
|---|
| 13 | 
The following adds 1 hour to 34 minutes:
RETURN apoc.date.add(34, "minutes", 1, "hour") AS outputInMinutes;| outputInMinutes | 
|---|
| 94 |