Post Reply 
Year(s) Month(s) Day(s) between 2 dates
10-21-2015, 01:10 PM (This post was last modified: 10-21-2015 01:33 PM by Dieter.)
Post: #6
RE: Year(s) Month(s) Day(s) between 2 dates
(10-19-2015 09:33 AM)ggauny@live.fr Wrote:  I wonder if it's a way to load in one list the "31 STO 01 STO 03 etc.", I've check anywhere but I don't find.

You do not need a list, you can compute the number of days in a month directly. It's just 12 steps on the 34s:

Code:
01 RCL X
02 #008
03 IDIV
04 RCL+ Y
05 #002
06 MOD
07 #002
08 x≠? Z
09 Clx
10 -
11 #030
12 +

If you perfer a closed formula instead of a test: n = 28 + (m + m div 8) mod 2 + 2 · abs(sign(m–2)).
And if February is neglected (:= 30 days) it even boils down to 30 + (m + m div 8) mod 2.

By the way...

(10-19-2015 09:33 AM)ggauny@live.fr Wrote:  This routine is precise because we work with really numbers of days into month

...in many cases there is no "precise" result. The number of days depends on how you count them. This was already discussed in march when we have been talking about this topic in another thread (cf. post #9 and #12).

Dieter
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 - Dieter - 10-21-2015 01:10 PM



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