Post Reply 
(35S) years, months and days between two dates
06-14-2016, 09:31 PM (This post was last modified: 06-14-2016 09:42 PM by Dieter.)
Post: #5
RE: HP 35s: years, months and days between two dates
(06-13-2016 04:37 AM)Ender Wrote:  Nicely done Dieter. Just a question. What if the number of days add up to more than 30? Say 2 Feb 2016 to August 31 2017. 27 days to end of February plus 30 days from start of 1 August to 30 August.

Simple. In this case there is an unambiguous solution because day2 > day1. So the result is 1 year, 6 months and 29 days.

I wrote the program "...counts the number of days until the end of the first month, then determines the number of months and years until the second month, and finally adds the number of days in the latter.". This rule is only applied where more than one valid result may exist, i.e. where day2 < day1. Sorry if I was not clear enough here.

BTW, looking at the program again I found an error in line Y060 that is now corrected. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 35s: years, months and days between two dates - Dieter - 06-14-2016 09:31 PM



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