apoc.date.toYears
Function APOC Core
toYears(timestamp) or toYears(date[,format]) - converts timestamp into floating point 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 |