Post Reply 
Year(s) Month(s) Day(s) between 2 dates
10-29-2015, 07:52 AM
Post: #35
RE: Year(s) Month(s) Day(s) between 2 dates
(10-28-2015 03:24 PM)fhub Wrote:  
(10-28-2015 12:11 PM)Didier Lachieze Wrote:  ..., and the results are aligned with WolframAlpha:
Yes, your new version behaves in fact exactly like WolframAlpha - look at the following 2 examples:
30.012015 to 29.032015 --> 1 month 29 days
31.012015 to 29.032015 --> 1 month 29 days

Ooops, 2 different start days give the same result?
So for WolframAlpha (and for you) 30.Jan and 31.Jan are the same day?
(and there's no 30. or 31. Feb to which you could move forward from the Jan. start day)

Doesn't seem very logical to me, not even if WolframAlpha states it. Wink

Yes, it’s far from perfect. But the problem in calculating date intervals here is that we are dealing with a variable unit (a month can be 28, 29, 30 or 31 days long), so troubles occur at the boundaries.

With your program there are also some discontinuities:
25.012015 to 28.022015 --> 1 month 3 days
25.012015 to 01.032015 --> 1 month 7 days (+4 days!)

Adding one day to the end date increases the result by 4 days! 3 “phantom” days have been added between the 28 of February 2015 and the 1st of March 2015.

And this depends also on the start month:
25.112014 to 28.022015 --> 3 month 3 days
25.112014 to 01.032015 --> 3 month 6 days (+3 days!)

Here only 2 “phantom” days have been added between the 28 of February 2015 and the 1st of March 2015.

All this is not very consistent and without a clear and agreed standard way of calculating date intervals the results are quite useless from my point of view.
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-29-2015 07:52 AM



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