Days between dates calculation



#5

I'm writing code for my 41CV to replicate the DATE function in the 12C (the code that came with the 41CV for calendar math isn't as rigorous as that used by later calculators).

The 12C manual shows the formula used to convert dd.mmyyyy inputs into absolute days. So once you input, say, March 3 2004 into the y register, and 10 as the number of incremental days, you can calc what the new absolute day figure is for 10 days after March 3, 2004. But converting this back to 3,13,2004 is a bit of a puzzle.

Furthermore, it appears to me that the formulas used even by the later calculators isn't exactly right: Years evenly divisible by 400 are leap years, but years evenly divisible by 100 aren't; of course, years evenly divisible by 4 are. The formula HP uses on the 12C, 19BII, etc. doesn't take this into account, so when it calculates the number of days between 31 Dec 1899 and today, it'll be off by 1 day.


#6

Hi! There is a set of programs by Christoph Giesselink that does exactly this for the HP-42S on my homepage and that works on every year between 1583 and 9999.

Should be very easy to adapt these programs for the HP-41C series.

Best regards,


Erik Ehrling (Sweden)


Homepage:http://www.hp42s.com

#7

The Sky & Telescope website has BASIC programs which are easily converted to RPN. They use the Julian Day Number which begins at noon on January 1, 4713 B.C. You can convert dates to the JDN and visa-versa. Find the difference between two day numbers and you have the number of days in between.

tm


#8

I found that the time module (or a 41CX) DDays function is accurate. So may be you can just get a time module?


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 492 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP50G early days vs Prime early days? Mike Powell 7 504 10-09-2013, 11:17 AM
Last Post: Eric Rechlin
  [HP-Prime] AMBIGUITY between Numerical Calculation (HOME) and Numerical/Symbolic Calculation (CAS mode) CompSystems 2 297 08-18-2013, 07:06 PM
Last Post: CompSystems
  slow calculation Bill Plaxton 3 335 08-15-2013, 11:57 AM
Last Post: Bill Plaxton
  hp 17bii+ dates calculation... JoePaul 6 550 07-14-2013, 11:32 AM
Last Post: Katie Wasserman
  Casio fx-CP400 emulator (90 days trial) Mic 2 430 05-16-2013, 01:07 PM
Last Post: critor
  HP35 Ad. from 1972 with calculation error reused in 2009? Michael Kathke 46 2,611 05-14-2013, 03:52 PM
Last Post: Dieter
  Good (simple?) calculation for benchmarking? Jedidiah Smith 28 1,681 03-01-2013, 05:13 PM
Last Post: Harald
  Complex number calculation on wp34s wildpig 13 682 08-30-2012, 09:46 AM
Last Post: Ángel Martin
  Introduction and discontinuation dates for HP Calculators Harald 9 617 07-30-2012, 04:43 PM
Last Post: Jake Schwartz

Forum Jump: