Results 1 to 2 of 2

Thread: Calculate days elapsed with varying accuracy

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    183

    Calculate days elapsed with varying accuracy

    I had a little incident trying to calculate today's Julian day number, and after failing to do so, I proceeded to develop the algorithm you see below. It's based on part of the algorithm I found for calculating the Julian day number. The accuracy of my algorithm varies depending on the number of years elapsed. For example I used my algorithm to calculate the days elapsed since January 1, 2000 and got a result that was just 1 day off. And I calculated again, using this date in 3000 as a start date, and got a result that was 9 days off.

    Here's the algorithm:

    A = floor(365.25 * Year)
    B = floor(30.6001 * Month)
    JD = A + B + Day + 1720995.0
    Note the value of JD then repeat the process for date 2 and note the new value of JD. Then the days elapsed is the difference between both values.

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: Calculate days elapsed with varying accuracy

    Is there a question? Or did you just want to post your algorithm?
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width