apoc.date.toYearsFunction
Syntax  | 
  | 
||
Description  | 
Converts the given timestamp or the given date into a   | 
||
Arguments  | 
Name  | 
Type  | 
Description  | 
  | 
  | 
The timestamp or datetime string to extract the years from.  | 
|
  | 
  | 
The format the given datetime string is in. The default is:   | 
|
Returns  | 
  | 
||
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  |