apoc.date.toYears
Function
apoc.date.toYears(value ANY, format STRING)
- converts the given timestamp or the given date into a FLOAT
representing years.
Usage Examples
The following converts a datetime in milliseconds to floating point years:
WITH datetime("2020-11-05").epochMillis AS datetime
RETURN apoc.date.toYears(datetime) AS years;
years |
---|
50.87945205479452 |
The following converts a date to floating point years:
RETURN apoc.date.toYears("2020-11-02", "YYYY-MM-dd") AS years;
years |
---|
2020.027397260274 |