Birthdate: time arithmetic is not reversible!

It’s 8 March 2008. Beth was born on 30 January 2008. How long ago was that, in months and days?

Well, it’s March 8 today, so if we go back one month and zero days, we get to February 8. So 7 February must have been one month and one day ago. So 1 February must have been one month and 7 days ago. 31 Jan was one month and 8 days ago. So 30 Jan was one month and 9 days ago. VoilĂ ! Beth is 1 month and 9 days old!

Ah, but, hang on. It’s 30 January 2008 and Beth has just been born. How old will she be on 8 March 2008, in months and days?

It’s 30 January, so going forward 1 month gets us to 30 February, which is past the end of the month. 29 February (it’s a leap year) is 0 months and 30 days from 30 January, counting each day on the calendar. So the next day, 1 March, must be 1 month and 0 days. So 8 March must be 1 month and 7 days from 30 January. Beth will be 1 month and 7 days old on 8 March 2008.

Working backwards to calculate the time interval in months and days can give a different result to working forwards! There are two different answers to Beth’s age! Which is right?

When I first noticed this, I thought the answer was obvious. “On 8 March 2008, I’m asked how long it is since Beth was born. So, I work backwards until I reach her birthdate, and that’s the answer.” That would be a month and 9 days. So, that’s how I originally wrote the birthdate calculator, to work backwards.

However, it’s now clear to me that that choice isn’t at all obvious. It’s quite possible for people to work things out the other way, working forwards, and sometimes get a different answer. I need to modify the birthdate calculator to take account of that. I’ve not done that yet, so, for the moment, it only works backwards from the end date to the birthdate. The maximum difference in birthdate is 3 days. There’s only ever a difference if the age is specified in months and either weeks or days. It depends on the difference in the number of days in the month at the start and the end of the time interval. I’ll work on it!

Leave a Reply

Your email address will not be published. Required fields are marked *