Post Reply 
Year(s) Month(s) Day(s) between 2 dates
10-23-2015, 03:42 PM
Post: #21
RE: Year(s) Month(s) Day(s) between 2 dates
Gérard has brought me an interesting question: with a start date of 23 Feb. 1951 and an end date of 5 Sept. 1999 the program from Dieter with ΔDAYS (as well as my optimized versions) returns 48 years, 6 months and 13 days, however Gerard’s own program as well as another one he has on the 50g (not written by him) returns 48 years, 6 months and 10 days.

The difference in the number of days comes from the way the interval duration is calculated:
If you add 48 years and 6 months to the start date you get 23 Aug. 1999, 13 days before 5 Sept. 1999.
However if you first add 10 days to the start date you get 5 mar. 1951 which is 48 years and 6 months before 5 Sept. 1999.

So we have two different numbers of days because the “6 months” are not the same months: in the first case the 28-day February is included in the 6 months* but not in the second case where it’s replaced by the 31-day August**, hence the 3 days difference.

As the answer depends on the order of operations maybe this should be reflected in the result: '48 years, 6 months and 13 days' or '10 days, 6 months and 48 years'.

I’ve checked a few on-line date interval calculators and I’ve got the two answers.

48 years, 6 months and 13 days:
48 years, 6 months and 10 days:
Does anybody knows if there is a standard rule for calculating such date intervals and if one of the two possible answers should be considered the right one?

*we add first the 48 years to get to 23 Feb. 1999, then we add the 28 days of Feb to 23 Mar. 1999, then the 31 days of Mar. to 23 Apr. 1999 .... and the 31 days of July to 23 Aug. 1999 and then 13 days to 5 Sept. 1999. So the 6 months are: Feb. Mar. Apr. May Jun. Jul.

**after adding 10 days to 23 Feb. 1951 we get to 5 Mar. 1951, then we add the 31 days of Marc. to 5 Apr. 1951 .... then the 31 days of Aug. to 5 Sept. 1951 and then the 48 years to 5 Sept. 1999. So the 6 months are: Mar. Apr. May Jun. Jul. Aug.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Year(s) Month(s) Day(s) between 2 dates - Didier Lachieze - 10-23-2015 03:42 PM



User(s) browsing this thread: 1 Guest(s)