Calculating age out of two dates
Added by Anonymous almost 13 years ago
Legacy ID: #10817359 Legacy Poster: https://www.google.com/accounts ()
Hello all, At some point Saxon had the function subtract-dates-yielding-yearMonthDuration that took two dates as an argument and generated a year month duration. such a function can be used to calculate the age of a person, and there is no equivalent in the Xpath spec. (there is substract-dates but it gives a dayTime duration and simple calculation (deviding the days by 265.25) will not be precise. It seems that this function is not available anymore. Is this functionality still available out of the box? I can't seem to find any recent reference to it many thanks for your help
Replies (1)
RE: Calculating age out of two dates
-
Added by Anonymous almost 13 years ago
Legacy ID: #10817603 Legacy Poster: Michael Kay (mhkay)
The functionality was dropped from the spec because of difficulty in agreeing the semantics, e.g. what is the result of subtracting 31 Jan 2008 from 28 Feb 2008. It gets even more difficult when the first date is earlier than the second. To calculate the age of a person who was born on 29 February 2004, what is their age on 28 February 2008? The WG couldn't agree on a set of rules that worked for everyone, so you will have to invent your own.
Please register to reply