Parameters, Value
Time difference function calculates the time difference between two datetime values (end_datetime
- start_datetime
) and returns that value (take the integer part).
If
end_date
andstart_date
are not homologous: when used in WITH,date_diff()
will first make a Cartesian Product Combination of all columns and its homologous columns before calculation; when used in RETURN,date_diff()
will trim all columns and their homologous columns before calculation.
Syntax:
- Format: date_diff(
<end_date>
,<start_date>
, "<interval>
") - Parameters: see table below
- Function: ATTR (time)
Name | Type | Specification | Description |
---|---|---|---|
end_datetime | ATTR (time) | / | End of the time |
start_datetime | ATTR (time) | / | Start of the time |
interval | String | day, hour, minute, second | The unit of the returned value |
The returned value is negative if
end_datetime
is earlier thanstart_datetime
.
Constant, Function
Example: calculate the days from the current system time to 2050 new year.
return date_diff("2050-01-01 0:0:0", now(), "day")
Alias
Example: calculate the number of days Card CA001 has been opened
find().nodes({_id == "CA001"}) as n
return date_diff(now(), n.open_date, "day")
Property
Example: find 10 @transfer
edges within the past year
find().edges({date_diff(now(), @transfer.time, "day") <= 365}) as e
limit 10
return e{*}