05-10-2017, 03:17 PM
Post: #6
 toml_12953 Senior Member Posts: 1,889 Joined: Dec 2013
(05-10-2017 01:28 PM)Vtile Wrote:  I have been in seach of simple algorithm to calculate dDays between two dates.

The JDN method is too heavy to my use (DM15/HP15C) as it needs to be accurate only between about 100 year time window.

I did found one that suits my use at: https://groups.google.com/forum/#!topic/...c9rcvY7d2s

Now interesting enough I did put 3 different methods to the excel worksheet to compare them simultaneusly.. If I take DDays from 28.2.1900 and 28.2.2100 I get results:

Excel (365): 73050
JDN-JDN^^: 73049
HP50g DDAYS: 73049
SIMPLE DDAYS**: 73050
WAlpha: 73049 ( https://www.wolframalpha.com/input/?i=DA...+28.2.2100 ) PS. As late though

So which ones are correct? :/ Any idea.. I trush 50g more than excel, since also the JDN-JDN gives the same result but..
First I though that excel handles days as Ddays+1, but no it were false assumption since

DDAYS(28.3.1900,28.2.2100) returns as follows:
Excel: 73021
JDN-JDN: 73021
HP50g DDAYS: 73021
Simple DDAYS: 73020

EDIT2: Ahaa, Excel DAYS function starts at year 1900 that might explain this difference in this particular case.

Interesting.. Back to jellyfying my brains with day algorithms. :Z

** From mailinglist discussion
Y <- start year
M <- start month
D <- start day
Y <- Y-1
M <- M+13
X <- int(365.25*Y)+int(30.6*M)+D

^^
As given in wikipedia.org
https://en.wikipedia.org/wiki/Julian_day
https://wikimedia.org/api/rest_v1/media/...0958a53d61

One might include both endpoints and one might not.
The difference between 1/5/2017 and 2/5/2017 would be 1 or 2 depending on that.

Tom L

Tom L

Tom L
Cui bono?
 « Next Oldest | Next Newest »