Date addition: can it be done in a single HP 65 program card?
|
01-03-2020, 02:33 AM
Post: #13
|
|||
|
|||
RE: Date addition: can it be done in a single HP 65 program card?
Alright, I managed to cram pretty much all the functionality of the 67 Standard Pac calendar program into two sides of a single 65 card:
Side 1: A: Days between dates (calls B on x and y and subtracts the values) B: Date to day number (Julian date without the 1,720,982 offset added; preserves stack Y register) C: Date to day of week (calls B then falls through to D) D: Day number to day of week Side 2: A: Day number to date B: Number of days to weeks+days The usage is understandably different from the 67 version, e.g. if you want to compute a future/past date, you load side 1, enter the starting date and press B to convert to a day number, add/subtract a number of days, then load side 2, and press A to convert back to a readable date. If you need to compute several offsets from the same date, you can store the day number in R7-R9, which aren't used by side 2, then recall the day number, add/subtract, and convert to a date as many times as needed. Like the 67 version, it's limited to 1901-2099 due to not calculating leap years correctly for years that are divisible by 100 but not divisible by 400. I need to test it a bit more, and make the code more readable than my messy notes, then I'll probably add it to the software library forum. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 10 Guest(s)