note 41785 deleted from function.mktime by derick

From: Date: Sun, 24 Sep 2006 12:05:21 +0000
Subject: note 41785 deleted from function.mktime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117526@lists.php.net to get a copy of this message
Note Submitter: php at cNhOiSpPpAlMe dot org ---- 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); } ?>

« previous php.notes (#117526) next »