note 86766 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 22 Mar 2009 18:46:00 +0000 |
| Subject: | note 86766 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152301@lists.php.net to get a copy of this message | ||
Note Submitter: Grapsus
----
Here's a small function which returns TRUE if European Summer Time is used (now or at a given
date) :
<?php
if(!function_exists('estdst'))
{
function estdst($ts=false)
{
$ts = $ts?$ts:time();
$year = gmdate('Y', $ts);
$end = gmmktime(1, 0, 0, 3, 31 - ((5 * $year) / 4 + 4)%7, $year);
$start = gmmktime(1, 0, 0, 10, 31 - ((5 * $year) / 4 + 1)%7, $year);
return $ts < $end || $ts > $start;
}
}
?>
Calculation formula taken from here : http://en.wikipedia.org/wiki/European_Summer_Time