FacebookTwitterGoogle+Share

PHP holidays dates

Sometimes you need to the dates for holidays in PHP. All of the following will return timestamps.

Calculating Victoria day in PHP

function victoria_day() {
	$t = strtotime('May 25');
	return $t - (date("N")-1)*24*60*60;
}

Finding (Canadian) Thanksgiving in PHP

$thanksgiving = strtotime('second monday of November');

Returning Labour day in PHP

$thanksgiving = strtotime('First monday of September');

Calculating Easter in PHP

$easter = easter_date();

Of course some holidays are easier than others. For example, retrieve Canada day in PHP is just:

$canadaDay = strtotime('July 1');

Comments

You must be logged in to post a comment.