Yes John, however, what I need is the number of days between "today" and
the expiration date, adjusted for any leap days that might fall within
the interval.  I thought I'd try a method that multiplies the raw* 
number of days by 365.2425/365 (a "summation" of the non-linear formula 
you describe below) in order to more easily get to within a day or so of 
the target date.

*raw number of days = target day number minus today's day number, where
day numbers are determined using simple 365-day years, relative to year
zero.

I'm going to plug the calculations into a spreadsheet this morning and 
we'll see how accurate it is.


At 11:22 PM 9/12/2005, John Gilmore wrote:
  
>There is no need to use a simplified or 'linear'  leap-year correction 
>calculation.  For any algebraic Gregorian year value y the exact signed number 
>of leap-year correction days in preceding years is easily calculated by the 
>method of inclusions and exclusions.  It is just
>
>C(y) = 365(y - 1)
> + (y - 1)//4
> -  (y - 1)//100
> + (y - 1)//400
>
>in which '//' denotes remainder-discarding binary-integer division.
>
>



==================================================
Art Celestini       Celestini Development Services
Phone: 201-670-1674                    Wyckoff, NJ
=============  http://celestini.com  =============
Mail sent to the "From" address  used in this post
will be rejected by our server.   Please send off-
list email to:  ibmmain<at-sign>celestini<dot>com.
==================================================

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to