Converts the period intho months as a float.
This will throw an exception if the time unit is not Years or Months.
quantlib