Posts Tagged ‘holiday’

PHP is holiday class

Test out is it a holiday for any given date.

This class currently support United States and Canada’s holidays.

Here is
United States holidays information.
Canadian Holidays information.

This PHP class supports different provinces have its own provincial holidays. For example, December 26th is statutory holiday for Ontario and New Brunswick in Canada.

Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
include_once("IsHoliday.php");
 
$h = new Holiday('US');
if($h->is_holiday('2010-07-04')) 
        echo "yes, 2010-07-04 is holiday in US <br>";
else	
        echo "no <br>";
 
 
//Using Canadian province code for specific province
$h = new Holiday('Canada','ON');
if($h->is_holiday('2010-12-26')) 
        echo "yes, 2010-12-26 is holiday in Canada <br>";
else	
        echo "no <br>";
?>

Download source code here

  • Share/Save/Bookmark