Function dateDiff()
calculates the difference of two time values (end time minus start time) and returns that value (take the integer part).
Arguments:
- End time <datetime | timestamp | string>
- Start time <datetime | timestamp | string>
- Unit <string>, valid options: day, hour, minute, second
Returns:
- Time difference <number>
This function returns a negative value when the end time is earlier than the start time. If the end time and the start time are non-homologous, Cartesian Product will be applied when being called in a WITH clause, or column length will be trimmed when being called in a RETURN clause.
Constant, Function
Example: calculate the days from the current system time to 2050 new year.
return dateDiff("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 dateDiff(now(), n.open_date, "day")
Property
Example: find 10 @transfer
edges within the past year
find().edges({dateDiff(now(), @transfer.time, "day") <= 365}) as e
limit 10
return e{*}