# HP Forums

Full Version: Odd date calc on 20b
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

While playing with my new 20b, I noticed something odd about the days between dates calculation. Try this and see what you get:

Date 1: 6.252003

Date 2: 12.312010

Actual days: 2746

Now switch to cal 360 and evaluate: -721,255 is what it shows on mine.

However, on both the 17BII+silver and 12c 25th ann. ed. the same calculations give these answers:

17BII+: Acutal days 2746

360 days 2706

12c: 2746

after pressing x<>y swap button it gives 2706

Hello,

so, do you know how they handle the 'day index' for a 'bad' date for the 360 calendar but a good date for the actual calendar (the only way it can happen is for the 31th of a month)...

it looks like they just take the 'day index' for day 30 of that month and then add 1... can yo confirm?

cyrille

Yes I believe that is what happens. When using 12/30 for 30 day calendar it returns 2,705. What does the 20b do instead when switching from actual to cal 360?

Quote:
so, do you know how they handle the 'day index' for a 'bad' date for the 360 calendar but a good date for the actual calendar (the only way it can happen is for the 31th of a month)...

All you need to do is look at the appendix of the 12C manual, all the date calculation arithmetic is there.

Edited: 9 Aug 2008, 12:47 p.m.

hello,

Quote:
Yes I believe that is what happens. When using 12/30 for 30 day calendar it returns 2,705. What does the 20b do instead when switching from actual to cal 360?

all calculations on dates are done in 360 mode, it creates a numerical index from the date using the following formula: 360*year+30*(month-1)+day-1.
when a date is invalid, it returns -1 or 0xffffffff.
since the day between function is baddly codded and does not check the return validity, it will return index from date 1 - 0xffffff therefore the change result.

cyrille