note 41785 added to function.mktime

From: Date: Thu, 22 Apr 2004 05:37:44 +0000
Subject: note 41785 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-68505@lists.php.net to get a copy of this message
Is it DST in the US on/at $dDate? (Regional exceptions not included.) Ref.: http://webexhibits.org/daylightsaving/e.html I use this function to calculate time differences between a server located in the US and a region not affected by DST, and vice-versa. <? function f_IsDstUS ($dDate) { // DST START (First Sunday in April at 2am) $dApril1stDay = mktime( 0,0,0, 4,1,date("Y",$dDate)); $dApril1stSunday = $dApril1stDay +((7-date("w",$dApril1stDay))%7)*(60*60*24); $dDstStart = mktime( 2,0,0, date("m",$dApril1stSunday), date("d",$dApril1stSunday), date("Y",$dApril1stSunday)); // DST END (Last Sunday in October at 2am) $dOctoberLastDay = mktime( 0,0,0, 11,0,date("Y",$dDate)); $dOctoberLastSunday = $dOctoberLastDay -(date("w",$dOctoberLastDay))*(60*60*24); $dDstEnd = mktime( 2,0,0, date("m",$dOctoberLastSunday), date("d",$dOctoberLastSunday), date("Y",$dOctoberLastSunday)); // DST? return intval( $dDate >= $dDstStart && $dDate < $dDstEnd); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41785 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41785&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41785&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68505) next »