SP4CEBAR 2022-08-15 11:22
To calculate the number of days between two dates
converting dates is quite annoying, because they are really quite irregular
was8bit 2022-08-15 13:18
Does it account for variations like leap years, etc... or just averaged estimates?
SP4CEBAR 2022-08-15 14:40 (Edited)
It accounts for all of them in order to calculate the number of days, and it uses averages to tell you how many years, and months that is equivalent to
was8bit 2022-08-15 19:16
Yes, it could get messy very quickly to try to keep it real-real as the calendars always seem to change over the years, etc...
SP4CEBAR 2022-08-15 20:43 (Edited)
Yes, in testing I had to step through the days very slowly: January was quite easy, February took a few hours, March was tricky, June didn't want to work, August was a bit tricky, September needed a rework, and December needed some adjustments, and then I had to fix leap years, which wasn't too hard
And then the cycle repeated when I made the time encoder (which was even harder)
was8bit 2022-08-15 23:17
Wowzers, thats alot of work!
nathanielbabiak 2023-01-07 01:33 (Edited)
If you get crazy-detailed about the LowRes NX rules for rounding-near-zero and order-of-operations, you can implement date serial numbers in a single line of code.
It's called a Julian day calculation (implemented here if you're interested).
SP4CEBAR 2023-01-07 14:57
But it doesn't seem to provide much more simplicity for the encoding of dates into a human readable format (it is similar in complexity to my algorithm)