PHPRO.ORG

By Kevin Waterson

Equinox: (Latin: Equal night)
This example came about after a previous example to get the season for a given date. In the southern hemisphere, seasons are calculated simply by date. Summer down here begins on December first, Autumn on March first, Winter on June first, and Spring on September first.

This works well, and the seasons can be adjusted simply to transpose them into values that correspond to the nothern hemisphere. But these dates do not truely reflect the beginning of spring in the northern hemisphere, or autumn in the southern hemisphere.

Historically, in the northern hemisphere, the beginning of spring is marked by the spring, or Vernal, Equinox. The Vernal Equinox marks the point in time when the Sun crosses the celestial equator from south to north.

In 1582, Pope Gregory replaced the Julian calendar, with his own Gregorian calendar. This was due the leap year rules that poorly reflected astronimcally. Greg decided that by shortening the average calendar year. In contrast to the Julian calendar’s leap-year rule, there would be no leap day in years whose number could be divided directly by 100 but not by 400. Why 400?

Every 400 years, the Vernal Equinox is a 7:30am GST, eg: 2000, 2004, 2008 etc. and every four year is a leap year. This provides 97 leap days each 400 years using the Gregorian calendar. The Julian calendar is slipping behind slowly because of this. Which makes calculating seasons, or Easter fall into two camps, the Papists or the Orthodox.

Traditionally, Easter falls after the first full moon following the vernal or spring equinox. Later this would be changed by The Council of Nicaea said the date of Easter should be the first Sunday after the full moon following the vernal equinox.

This ruling made the calculation of two Easters, one for each branch of the church, then to make it even more interesting, the Nicaea ruling stated "Easter should not be celebrated with the Jews". So, if Easter fell on passover, it had to be put forward on week.

With all this in mind, lets find out when the spring, or vernal, equinox falls.


<?php

    
/**
     *
     * @Get Timestamp for Vernal Equinox
     *
     * @param int $year
     *
     * @return int
     *
     */
    
function getEquinox($year$timezone='Etc/GMT')
    {
        
date_default_timezone_set($timezone);
        
/*** the base gmt time ***/
        
$gmt gmmktime(000112000);

        
$days_from_base 79.3125 + ($year 2000) * 365.2425;
        
$seconds_from_base $days_from_base*86400;

        
$equinox round($gmt $seconds_from_base);
        return 
$equinox;
    }
?>

Example Usage


<?php

    
foreach(range(20002010) as $year)
    {
        echo 
'Timestamp is 'getEquinox($year).'<br />';
        echo 
'Equnox time is '.date('Y m d H:i:s'getEquinox($year)).'<br />';
        echo 
'<br />';
    }
?>

Demonstration

Timestamp is 953537400
Equnox time is 2000 03 20 07:30:00

Timestamp is 985094352
Equnox time is 2001 03 20 13:19:12

Timestamp is 1016651304
Equnox time is 2002 03 20 19:08:24

Timestamp is 1048208256
Equnox time is 2003 03 21 00:57:36

Timestamp is 1079765208
Equnox time is 2004 03 20 06:46:48

Timestamp is 1111322160
Equnox time is 2005 03 20 12:36:00

Timestamp is 1142879112
Equnox time is 2006 03 20 18:25:12

Timestamp is 1174436064
Equnox time is 2007 03 21 00:14:24

Timestamp is 1205993016
Equnox time is 2008 03 20 06:03:36

Timestamp is 1237549968
Equnox time is 2009 03 20 11:52:48

Timestamp is 1269106920
Equnox time is 2010 03 20 17:42:00