Re: Personal Calendar Server Volunteer? (fwd)



On Mon, 7 Feb 2000, Ted Rolle wrote:

> The Julian date is the number of days since January 1, 4713 B.C.E.
> It makes a good starting point.  Then we can map whatever calendar scheme
> we want to the Julian date.
> 
> PHP has routines to convert from Gregorian to Julian and from Julian to
> Hebrew.  That's how I implemented my Hebrew calendar.

In case you guys are interested here is a snippet from libastro that
determines the Julian day number:


--- BEGIN CODE ---

/* Compute the julian day number for a given date.
 * Julian Date is the number of days since noon of Jan 1 4713 B.C.
 *
 * Time zone offset is given by astro_time_get_timezone_seconds_offset
 */

gdouble astro_time_get_julian_day_number(guint year, guint month, guint
day, gdouble timezoneoffset) {
        gdouble A, B, C, D, JD, jday;

        jday = day + timezoneoffset/24.0;
        if ((month == 1) || (month == 2)){
                year = year - 1;
                month = month + 12;
        }

        if(((gdouble)year+month/12.0+jday/365.25)>=(1582.0+10.0/12.0+15.0/365.25)){
                        A = ((gint)(year / 100.0));
                        B = 2.0 - A + (gint)(A/4.0);
        }
        else{
                        B = 0.0;
        }

        if (year < 0.0){
                C = (gint)((365.25*(gdouble)year) - 0.75);
        }
        else{
                C = (gint)(365.25*(gdouble)year);
        }

        D = (gint)(30.6001*(gdouble)(month+1));

        JD = B + C + D + jday + 1720994.5;
        return(JD);
}

--- END CODE ---


A commit is coming I promise :).

Rusty

-- 
Rusty Conover        | rusty@zootweb.com 
Systems Programmer   | 406-586-5050 x242
Zoot Enterprises     | http://www.zootweb.com  



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]