quantlib.time.date.years

years(Period p)

Converts the period into years as a float.

This will throw an exception if the time unit is not Years or Months.