Re: Help with Calendar Functions!!

From: Date: Fri, 10 Nov 2000 17:47:13 +0000
Subject: Re: Help with Calendar Functions!!
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3787@lists.php.net to get a copy of this message
Joey Garcia wrote: > I figured it was a BC date, but why that date? What is the coorelation > between -4713 and 2000? Would 2001 be -4712? What is the algorithm to > convert it or how do I use -4713, or whatever BC date, to get the current > year? What is funny is that how could it come back with a result of 10/28 > (month/day) for Julian Day of 301 when it doesn't know the year? (Leap year > can throw that off) > > I tried your example but that just gave me a result of "2451859", but no > matter what I do I can't get that to convert to the current year(2000). > Again, I don't know the correct algorithm, I get either 1999 or 2004 > depending if I use 365 or 365.25. > > Can you get a Julian day from a date using these functions? Joey, I think the problem you're having is NOT with the functions themselves, but with an understanding of what the functions do... here's a quote from the php manual on the Calendar functions - "The calendar extension presents a series of functions to simplify converting between different calendar formats. The intermediary or standard it is based on is the Julian Day Count. The Julian Day Count is a count of days starting way earlier than any date most people would need to track (somewhere around 4000bc). To convert between calendar systems, you must first convert to Julian Day Count, then to the calendar system of your choice. Julian Day Count is very different from the Julian Calendar!" The problem is you are trying to get a Julian day within the current year... yet, what the JD functions do is give you a Julian Day Count... in other words it gives you the number of days since the start of the julian calendar (somewhere in 4713 B.C.). I don't work with the calendar stuff much, so I don't know what algorithm you specifically want for "Current julian day in my year", but I know that the jd functions probably won't give you what you're looking for. Perhaps try this... 1st convert today's date - 11/9/2000 - from gregorian to JD. Then convert back to julian from the JD. In other words... list ($m, $d, $y) = explode ('/', date ('m/d/Y')); $jd = gregoriantojd ($m, $d, $y); $juliandate = jdtojulian($jd); Now of course, this is only going to give you the month/day/year of the "julian"-ed :) version of the current date... what the algoritm is to extract the "Day of the year" from this julian date, I have NO clue :) Perhaps you can then work with the regular date functions at that point? -- Andy Hoffman Web Developer Bristol-Myers Squibb email: andy.hoffman@bms.com

« previous php.windows (#3787) next »