PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

cal_days_in_month> <bzwrite
Last updated: Sun, 25 Nov 2007

view this page in

Calendar 日历函数

简介

日历扩展是由一系列简单的日历格式转换函数组成。媒介或标准是基于儒略日计数(Julian Day Count)。儒略日计数是从公元前 4713 年 1 月 1 日开始计算的。在不同的日历系统中转换,必须先将其转换为儒略日计数,然后转换为目标日历格式。儒略日计数与罗马儒略历(Julian Calendar)完全不同!更多关于儒略日计数的信息,请访问 » http://www.hermetic.ch/cal_stud/jdn.htm。更多关于日历系统的信息,请访问 » http://www.fourmilab.ch/documents/calendar/。从此页面引用的信息包含了这些介绍,在引号之内。

安装

要使用本类函数,需要在编译 PHP 时加上 --enable-calendar

PHP 的 Windows 版本已经内置该扩展模块的支持。无需加载任何附加扩展库即可使用这些函数。

运行时配置

本扩展模块在 php.ini 中未定义任何配置选项。

资源类型

本扩展模块未定义任何资源类型。

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

CAL_GREGORIAN (integer)
CAL_JULIAN (integer)
CAL_JEWISH (integer)
CAL_FRENCH (integer)
CAL_NUM_CALS (integer)
CAL_DOW_DAYNO (integer)
CAL_DOW_SHORT (integer)
CAL_DOW_LONG (integer)
CAL_MONTH_GREGORIAN_SHORT (integer)
CAL_MONTH_GREGORIAN_LONG (integer)
CAL_MONTH_JULIAN_SHORT (integer)
CAL_MONTH_JULIAN_LONG (integer)
CAL_MONTH_JEWISH (integer)
CAL_MONTH_FRENCH (integer)

以下常量自 PHP 4.3.0 起可用:

CAL_EASTER_DEFAULT (integer)
CAL_EASTER_ROMAN (integer)
CAL_EASTER_ALWAYS_GREGORIAN (integer)
CAL_EASTER_ALWAYS_JULIAN (integer)

以下常量自 PHP 5.0.0 起可用:

CAL_JEWISH_ADD_ALAFIM_GERESH (integer)
CAL_JEWISH_ADD_ALAFIM (integer)
CAL_JEWISH_ADD_GERESHAYIM (integer)

Table of Contents

  • cal_days_in_month — Return the number of days in a month for a given year and calendar
  • cal_from_jd — Converts from Julian Day Count to a supported calendar
  • cal_info — Returns information about a particular calendar
  • cal_to_jd — Converts from a supported calendar to Julian Day Count
  • easter_date — Get Unix timestamp for midnight on Easter of a given year
  • easter_days — Get number of days after March 21 on which Easter falls for a given year
  • FrenchToJD — Converts a date from the French Republican Calendar to a Julian Day Count
  • GregorianToJD — Converts a Gregorian date to Julian Day Count
  • JDDayOfWeek — Returns the day of the week
  • JDMonthName — Returns a month name
  • JDToFrench — Converts a Julian Day Count to the French Republican Calendar
  • JDToGregorian — Converts Julian Day Count to Gregorian date
  • jdtojewish — Converts a Julian day count to a Jewish calendar date
  • JDToJulian — Converts a Julian Day Count to a Julian Calendar Date
  • jdtounix — Convert Julian Day to Unix timestamp
  • JewishToJD — Converts a date in the Jewish Calendar to Julian Day Count
  • JulianToJD — Converts a Julian Calendar date to Julian Day Count
  • unixtojd — Convert Unix timestamp to Julian Day


cal_days_in_month> <bzwrite
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
Calendar
simon at chronolabs dot org dot au
17-Jun-2008 01:09
This is the Japanese calendar in a basic formation of php..

<?php

function JapaneseCalendar($unix_time, $gmt,
                         
$monthsystem = 0) {

$months[0]['name'] = array(  
   
'ichigatsu','nigatsu','sangatsu',
   
'shigatsu','gogatsu','rokugatsu',
   
'shichigatsu','hachigatsu','kugatsu',
   
'jūgatsu','jūichigatsu','jūnigatsu');
  
$months[0]['cause'] = array(
   
'first month',
   
'second month',
   
'third month',
   
'forth month',
   
'fifth month',
   
'six month',
   
'seventh month',
   
'eighth month',
   
'ninth month',
   
'tenth month',
   
'elventh month',
   
'twelve month');

$months[1]['name'] = array(  
   
'mutsuki','kinusaragi','yayoi',
   
'uzuki','satsuki','minatsuki',
   
'fumizuki','hazuki','nagatsuki',
   
'kaminazuki','shimotsuki','shiwasu');
                          
$months[1]['cause'] = array(
   
'affection month',
   
'changing clothes',
   
'new life',
   
'u-no-hana month',
   
'fast month',
   
'month of water',
   
'book month',
   
'leaf month',
   
'long month',
   
'month of gods',
   
'frost month',
   
'priests run');
  
$days['roman'] = array(  
   
'nichiyōbi','getsuyōbi','kayōbi',
   
'suiyōbi','mokuyōbi','kin\'yōbi','doyōbi');
$days['element'] =
   array(
'Sun','Moon','Fire','Water',
  
'Wood','Gold','Earth');
$days['day'] = array(
  
'tsuitachi','futsuka','mikka','yokka',
  
'itsuka','muika','nanoka','yōka',
  
'kokonoka','tōka','jūichinichi',
  
'jūninichi','jūsannichi','jūyokka',
  
'jūgonichi','jūrokunichi',
  
'jūshichinichi','jūhachinichi',
  
'jūkunichi','hatsuka',
  
'nijūichinichi','nijūninichi',
  
'nijūsannichi','nijūyokka',
  
'nijūgonichi','nijūrokunichi',
  
'nijūshichinichi','nijūhachinichi',
  
'nijūkunichi','sanjūnichi',
  
'sanjūichinichi');
                      
return  array(
"date"=>$days['roman'][date('w', $unix_time)].' '.
  
$days['day'][date('d', $unix_time)-1].' '.
  
$months[$monthsystem]['name'][date('n', $unix_time)-1].
  
' '.date('Y', $unix_time),"cause" =>
  
$days['element'][date('w', $unix_time)].
  
' '.$months[$monthsystem]['cause'][date('n', $unix_time)-1],
  
"time" => date('h:i:s A', $unix_time));
}

?>

When I first ran this routine, I was referencing $month not $months, and for some reason it was still returning the month but not the cause, but the variable didn't exist. I found this odd around this time. I didn't know what would cause my RSS Feed to display the month even when there was no variable referred to the data.
simon at chronolabs dot org dot au
20-Nov-2007 12:20
<?php

// You need to replace this section in Function EgyptianCalendar
// As well as Function MayanTihkalCalendar
$revolutionsperyear = $ttl_num / $i;
$numyears = floor((ceil($roun) / $revolutionsperyear));
$avg_num_month = $ttl_num_months/$i;
$jtl = abs(abs($roun) - ceil($revolutionsperyear*($numyears+1)));
while(
$month==0){
   
$day=0;
   
$u=0;
    foreach(
$monthusage as $key => $item){
       
$t=0;  
        foreach(
$item as $numdays){
           
$t++;
           
$tt=0;
            for(
$sh=1;$sh<=$numdays;$sh++){
               
$ii=$ii+1;
               
$tt++;
                if (
$ii==floor($jtl)){
                    if (
$roun<0){
                       
$daynum = $tt;
                       
$month = $t;
                    } else {
                       
$daynum = $numdays-($tt-1);
                       
$month = $avg_num_month-($t-1);
                    }
                   
$sequence = $key;
                   
$nodaycount=true;
                }
            }
            if (
$nodaycount==false)
               
$day++;
        }
       
$u++;
    }
}
?>

This section of code need to be changed in the calculation I noticed today in our RounCalendar we had a zero day this function will calculate the month and day correctly for the calendars, it is a pretty universe piece of code, I am sorry it wasn't properly tested and need some refactoring.
simon at chronolabs dot org dot au
09-Nov-2007 11:44
This is the egyptian calendar which was the first 365 day calendar on the planet it has no leap year which makes it a little inaccurate but you can work on your own implementation of this code when you like, this is another implementation of the roun floating point code which is a universal code for generating date codec's you can make practically all calendars with this code the $pweight is based on my research on carbon date stamping etc of when egypt epoch or PPO was made, some people argue a few thousand years while other can date egypts epoch being around 30000 years ago!! This is on the basis of tidal marking on statues and momuments when the are was covered in water after construction from sea level rising.

<?php

print_r
(EgyptCalendar(time(),0));

function
EgyptianCalendar($unix_time, $gmt,
                
$poffset = '1970-02-26 7:45 PM',
                
$pweight = '-9777600.22222222223',
                
$defiency='nonedeficient',
                
$timeset= array("hours" => 24,
                                
"minutes" => 60,
                                
"seconds" => 60))
{
// Code Segment 1 – Calculate Floating Point
$tme = $unix_time;

if (
$gmt>0){$gmt=-$gmt;} else {$gmt=abs($gmt);}

$ptime = strtotime($poffset)+(60*60*gmt);
$weight = $pweight+(1*gmt);

$egypt_xa = ($tme)/(24*60*60);
$egypt_ya = $ptime/(24*60*60);
$egypt = (($egypt_xa -$egypt_ya) -
        
$weight)+(microtime/999999);

// Code Segment 2 – Set month day arrays
$nonedeficient = array(
  
"seq1" => array(30,30,30,30,30,30,30,30,30,30,30,30,5));

$monthnames = array(
  
"seq1" => array('Thoth','Phaophi','Athyr','Choiak',
  
'Tybi', 'Mecheir','Phamenoth','Pharmuthi','Pachon',
  
'Payni','Epiphi','Mesore','epagomenai'));
                                   
$monthusage = isset($defiency) ? ${$defiency} : $deficient;

// Code Segment 3 – Calculate month number, day number
foreach($monthusage as $key => $item){
   
$i++;
    foreach(
$item as $numdays){
       
$ttl_num=$ttl_num+$numdays;
       
$ttl_num_months++;
    }
}

$revolutionsperyear = $ttl_num / $i;
$numyears = egyptd((floor($egypt) / $revolutionsperyear),0);
$avg_num_month = $ttl_num_months/$i;
$jtl = abs(abs($egypt) -
      
ceil($revolutionsperyear*($numyears+1)));

while(
$month==0){
   
$day=0;
   
$u=0;
    foreach(
$monthusage as $key => $item){
       
$t=0;  
        foreach(
$item as $numdays){
           
$t++;
           
$tt=0;
            for(
$sh=1;$sh<=$numdays;$sh++){
               
$ii=$ii+1;
               
$tt++;
                if (
$ii==floor($jtl)){
                    if (
$egypt>0){
                       
$daynum = $tt;
                       
$month = $t;
                    } else {
                       
$daynum = $numdays-$tt;
                       
$month = $avg_num_month-$t;
                    }
                   
$sequence = $key;
                   
$nodaycount=true;
                }
            }
            if (
$nodaycount==false)
               
$day++;
        }
       
$u++;
    }
}

//$numyears = abs($numyears);

$timer = substr($egypt, strpos($egypt,'.')+1,
   
strlen($egypt)-strpos($egypt,'.')-1);
$egypt_out= $numyears.'/'.$month.'/'.$daynum.' '.$day.'.'.
   
floor(intval(substr($timer,0,2))/100*$timeset['hours']).':'.
   
floor(intval(substr($timer,2,2))/100*$timeset['minutes']).':'.
   
floor(intval(substr($timer,4,2))/100*$timeset['seconds']).'.'.
   
substr($timer,6,strlen($timer)-6);
$egypt_obj = array('year'=>$numyears,
   
'month'=>$month,
   
'mname' => $monthnames[$sequence][$month-1],
   
'day'=>$daynum,
   
'jtl'=>$jtl,
   
'day_count'=>$day,
   
'hours'=>floor(intval(substr($timer,0,2))/100
            
*$timeset['hours']),
   
'minute'=>floor(intval(substr($timer,2,2))/100
             
*$timeset['minutes']),
   
'seconds'=>floor(intval(substr($timer,4,2))/100
              
*$timeset['seconds']),
   
'microtime'=>substr($timer,6,strlen($timer)-6),
                
'strout'=>$egypt_out);

return
$egypt_obj;
}

?>

btw in my previous post of the Mayan Tikal calendar the top part of the function was chopped off in my code cut and paste that is the line for the function which looks like, the top 3 line will need to be replace with:

<?php

print_r
(MayanTikalCalendar(time(),0));

function
MayanTikalCalendar($unix_time, $gmt,
                                  
?>
simon at chronolabs dot org dot au
08-Nov-2007 05:27
Well this is the second part, well more the second calendar of Maya the Tikal there is two of them one for long count, one for general date seeding, this is using an implementation of floating point time (roun).

<?php

$maya
= MayanTikalCalendar(time(),0);

print_r($maya);

                
$poffset = '2012-12-21 8:24 PM',
                
$pweight = '-1872000.22222222223',
                
$defiency='nonedeficient',
                
$timeset= array("hours" => 24,
                                
"minutes" => 60,
                                
"seconds" => 60))
{
// Code Segment 1 – Calculate Floating Point
$tme = $unix_time;
if (
$gmt>0){ $gmt=-$gmt; } else { $gmt=abs($gmt); }

$ptime = strtotime($poffset)+(60*60*gmt);
$maya_xa = ($tme)/(24*60*60);
$maya_ya = $ptime/(24*60*60);
$maya = (($maya_xa -$maya_ya) - $pweight)+(microtime/999999);

// Code Segment 2 – Set month day arrays
$nonedeficient = array(
"seq1" => array(20,20,20,20,20,20,20,20,20,
               
20,20,20,20,20,20,20,20,20,5));

$monthnames = array("seq1" => array(
 
'Pop', 'Uo', 'Zip', 'Zot\'z', 'Tzec', 'Xul',
 
'Yaxkin', 'Mol', 'Ch\'en', 'Yax', 'Zac', 'Ceh',
 
'Mac', 'Kankin', 'Muan', 'Pax', 'Kayab',
 
'Cumku', 'Uayeb'));
$daynames = array("seq1" => array(
 
'Imix', 'Ik', 'Akbal', 'Kan', 'Chicchan',
 
'Cimi','Manik', 'Lamat', 'Muluc', 'Oc',
 
'Chuen', 'Eb', 'Ben', 'Ix', 'Men',
 
'Cib', 'Caban', 'Etz\'nab', 'Cauac', 'Ahau'));
$monthusage = isset($defiency) ? ${$defiency} : $deficient;

// Code Segment 3 – Calculate month number, day numbers etc
foreach($monthusage as $key => $item){
   
$i++;
    foreach(
$item as $numdays){
       
$ttl_num=$ttl_num+$numdays;
       
$ttl_num_months++;
    }
}

$revolutionsperyear = $ttl_num / $i;
$numyears = (round((floor($maya) / $revolutionsperyear),0));
$avg_num_month = $ttl_num_months/$i;
$jtl = abs(abs($maya) -
      
ceil($revolutionsperyear*($numyears+1)));

while(
$month==0){
   
$day=0;
   
$u=0;
    foreach(
$monthusage as $key => $item){
       
$t=0;  
        foreach(
$item as $numdays){
           
$t++;
           
$tt=0;
            for(
$sh=1;$sh<=$numdays;$sh++){
               
$ii=$ii+1;
               
$tt++;
                if (
$ii==floor($jtl)){
                    if (
$maya>0){
                       
$daynum = $tt;
                       
$month = $t;
                    } else {
                       
$daynum = $numdays-$tt;
                       
$month = $avg_num_month-$t;
                    }
                   
$sequence = $key;
                   
$nodaycount=true;
                }
            }
            if (
$nodaycount==false)
               
$day++;
        }
       
$u++;
    }
}

$timer = substr($maya, strpos($maya,'.')+1,
        
strlen($maya)-strpos($maya,'.')-1);
$maya_out= $numyears.'/'.$month.'/'.$daynum.' '.$day.'.'.
 
floor(intval(substr($timer,0,2))/100*$timeset['hours']).':'.
 
floor(intval(substr($timer,2,2))/100*$timeset['minutes']).':'.
 
floor(intval(substr($timer,4,2))/100*$timeset['seconds']).'.'.
 
substr($timer,6,strlen($timer)-6);

$maya_obj = array(
 
'longcount'=>MayanLongCount($tme),'year'=>abs($numyears),
 
'month'=>$month, 'mname' => $monthnames[$sequence][$month-1],
 
'day'=>$daynum, 'dayname'=>$daynames[$sequence][$daynum-1],
 
'day'=>$daynum, 'jtl'=>$jtl, 'day_count'=>$day,
 
'hours'=>     floor(intval(substr($timer,0,2))/100
            
*$timeset['hours']),
 
'minute'=> floor(intval(substr($timer,2,2))/100
            
*$timeset['minutes']),
 
'seconds'=>floor(intval(substr($timer,4,2))/100
            
*$timeset['seconds']),
 
'microtime'=>substr($timer,6,strlen($timer)-6),
 
'strout'=>$maya_out);

return
$maya_obj;
}

?>
simon at chronolabs dot org dot au
07-Nov-2007 10:00
This will return the mayan long count calendar which cycle reaches 13.0.0.0.0 in 2012, I have had to compress the changemaya function for this code library so if you want to space it out your more than welcome. It works with unix time. To call the routine use the following syntax. The mayan calendar is a day count that is around 5000 years old, it tracks our cestial position in the galaxy

<?php

echo MayanLongCount(time());

function
MayanLongCount($tme){
   
   
$config = array('ppo' => array(13,0,0,0,0),
                   
'epoch' => strtotime('2012-12-21'));

   
$diff=(($tme-$config['epoch'])/(60*60*24));
   
$ppo = changemaya($config['ppo'],ceil($diff));

    return
$ppo[0].'.'.$ppo[1].'.'.$ppo[2].'.'.$ppo[3].'.'.$ppo[4];
}

function
changemaya($ppo,$diff){
if (
$diff>0) { $amount=1; } else { $amount=-1; }
for (
$sh=1;$sh<abs($diff);$sh++){ if ($ppo[4]+$amount>20){
if (
$ppo[3]+$amount>20){ if ($ppo[2]+$amount>20){
if (
$ppo[1]+$amount>20){ if ($ppo[0]+$amount>20){
$ppo[0]=0; $ppo[1]=0; $ppo[2]=0; $ppo[3]=0; $ppo[4]=0;
} else {
$ppo[1]=0; $ppo[0]=$ppo[0]+$amount;}       
} else {
$ppo[2]=0; $ppo[1]=$ppo[1]+$amount;    }       
} else {
$ppo[3]=0; $ppo[2]=$ppo[2]+$amount; }
} else {
$ppo[4]=0; $ppo[3]=$ppo[3]+$amount; }
} elseif (
$ppo[4]+$amount<0){ if ($ppo[3]+$amount<0){
if (
$ppo[2]+$amount<0){    if ($ppo[1]+$amount<0){
if (
$ppo[0]+$amount<0){    $ppo[0]=20;    $ppo[1]=0;
$ppo[2]=0; $ppo[3]=0; $ppo[4]=0;
} else {
$ppo[1]=20; $ppo[0]=$ppo[0]+$amount; }       
} else {
$ppo[2]=20; $ppo[1]=$ppo[1]+$amount; }       
} else {
$ppo[3]=20; $ppo[2]=$ppo[2]+$amount; }
} else {
$ppo[4]=20; $ppo[3]=$ppo[3]+$amount; }
} else {
$ppo[4]=$ppo[4]+$amount;}}
    return
$ppo;
}

?>

Thanks!!
Martin Lindhe
27-Sep-2007 05:08
To calculate NTP timestamp from unix timestamp:

<?
function ntptime()
{
    return 2208988800 + time();
}
?>

NTP timestamps are represented as a 64-bit unsigned fixed-
point number, in seconds relative to 0h on 1 January 1900.
schotm29 at hotmail dot com
07-Sep-2007 06:00
fRay Fergusons light reimplimentation doesn't work all of the time, because of the inaccuracy in the calculations (it is quite accurate but not accurate enough for a live web app)
david dot scourfield at llynfi dot co dot uk
17-Aug-2007 03:13
I created this function a while ago and needed it again recently, so had to trawl through some old files to find it. Thought I'd post it here in case anyone else finds it useful.

<?php

/*
 *    Function to calculate which days are British bank holidays (England & Wales) for a given year.
 *
 *    Created by David Scourfield, 07 August 2006, and released into the public domain.
 *    Anybody may use and/or modify this code.
 *
 *    USAGE:
 *
 *    array calculateBankHolidays(int $yr)
 *
 *    ARGUMENTS
 *
 *    $yr = 4 digit numeric representation of the year (eg 1997).
 *
 *    RETURN VALUE
 *
 *    Returns an array of strings where each string is a date of a bank holiday in the format "yyyy-mm-dd".
 *
 *    See example below
 *
 */

function calculateBankHolidays($yr) {

   
$bankHols = Array();

   
// New year's:
   
switch ( date("w", strtotime("$yr-01-01 12:00:00")) ) {
        case
6:
           
$bankHols[] = "$yr-01-03";
            break;
        case
0:
           
$bankHols[] = "$yr-01-02";
            break;
        default:
           
$bankHols[] = "$yr-01-01";
    }

   
// Good friday:
   
$bankHols[] = date("Y-m-d", strtotime( "+".(easter_days($yr) - 2)." days", strtotime("$yr-03-21 12:00:00") ));

   
// Easter Monday:
   
$bankHols[] = date("Y-m-d", strtotime( "+".(easter_days($yr) + 1)." days", strtotime("$yr-03-21 12:00:00") ));

   
// May Day:
   
if ($yr == 1995) {
       
$bankHols[] = "1995-05-08"; // VE day 50th anniversary year exception
   
} else {
        switch (
date("w", strtotime("$yr-05-01 12:00:00"))) {
            case
0:
               
$bankHols[] = "$yr-05-02";
                break;
            case
1:
               
$bankHols[] = "$yr-05-01";
                break;
            case
2:
               
$bankHols[] = "$yr-05-07";
                break;
            case
3:
               
$bankHols[] = "$yr-05-06";
                break;
            case
4:
               
$bankHols[] = "$yr-05-05";
                break;
            case
5:
               
$bankHols[] = "$yr-05-04";
                break;
            case
6:
               
$bankHols[] = "$yr-05-03";
                break;
        }
    }

   
// Whitsun:
   
if ($yr == 2002) { // exception year
       
$bankHols[] = "2002-06-03";
       
$bankHols[] = "2002-06-04";
    } else {
        switch (
date("w", strtotime("$yr-05-31 12:00:00"))) {
            case
0:
               
$bankHols[] = "$yr-05-25";
                break;
            case
1:
               
$bankHols[] = "$yr-05-31";
                break;
            case
2:
               
$bankHols[] = "$yr-05-30";
                break;
            case
3:
               
$bankHols[] = "$yr-05-29";
                break;
            case
4:
               
$bankHols[] = "$yr-05-28";
                break;
            case
5:
               
$bankHols[] = "$yr-05-27";
                break;
            case
6:
               
$bankHols[] = "$yr-05-26";
                break;
        }
    }

   
// Summer Bank Holiday:
   
switch (date("w", strtotime("$yr-08-31 12:00:00"))) {
        case
0:
           
$bankHols[] = "$yr-08-25";
            break;
        case
1:
           
$bankHols[] = "$yr-08-31";
            break;
        case
2:
           
$bankHols[] = "$yr-08-30";
            break;
        case
3:
           
$bankHols[] = "$yr-08-29";
            break;
        case
4:
           
$bankHols[] = "$yr-08-28";
            break;
        case
5:
           
$bankHols[] = "$yr-08-27";
            break;
        case
6:
           
$bankHols[] = "$yr-08-26";
            break;
    }

   
// Christmas:
   
switch ( date("w", strtotime("$yr-12-25 12:00:00")) ) {
        case
5:
           
$bankHols[] = "$yr-12-25";
           
$bankHols[] = "$yr-12-28";
            break;
        case
6:
           
$bankHols[] = "$yr-12-27";
           
$bankHols[] = "$yr-12-28";
            break;
        case
0:
           
$bankHols[] = "$yr-12-26";
           
$bankHols[] = "$yr-12-27";
            break;
        default:
           
$bankHols[] = "$yr-12-25";
           
$bankHols[] = "$yr-12-26";
    }

   
// Millenium eve
   
if ($yr == 1999) {
       
$bankHols[] = "1999-12-31";
    }

    return
$bankHols;

}

/*
 *    EXAMPLE:
 *
 */

header("Content-type: text/plain");

$bankHolsThisYear = calculateBankHolidays(2007);

print_r($bankHolsThisYear);

?>

Will output this result:

Array
(
    [0] => 2007-01-01
    [1] => 2007-04-06
    [2] => 2007-04-09
    [3] => 2007-05-07
    [4] => 2007-05-28
    [5] => 2007-08-27
    [6] => 2007-12-25
    [7] => 2007-12-26
)
fRay Ferguson
21-Apr-2006 07:32
The following is a light reimplimentation of some of these functions wich can be used in an include file to work around the lack of --with-calendar in php implimentations.

<?php

/* IMPLEMENTS SUBSET OF PHP CALENDAR FUNCTIONS ON SYSTEMS COMPILED W/O --enable-calendar */

if (!function_exists('cal_days_in_month')){
        function
cal_days_in_month($a_null, $a_month, $a_year) {