note 67084 deleted from function.mktime by derick

From: Date: Sun, 24 Sep 2006 11:49:34 +0000
Subject: note 67084 deleted from function.mktime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117496@lists.php.net to get a copy of this message
Note Submitter: dswigger at yahoo dot com ---- Thought I would share a bit. Hope someone finds it useful. // The logic was ported from javascript : http://webexhibits.org/daylightsaving/b.html // If any date is between these two then: //During DST, clocks are turned forward an hour, effectively moving an hour of daylight from the morning to the evening. define('ZT_DST_US', 1);//United States dst define('ZT_DST_EU', 2);//European Union dst function ztcalhlp_getGMTDST(&$destStart,&$destEnd,$year,$dst_type=ZT_DST_EU) { // USA if($dst_type == ZT_DST_US) { $dstTime=2; $AprilDate=(2+6 * $year - floor($year / 4) ) % 7 + 1; $OctoberDate=(31-(floor ($year * 5 / 4) + 1) % 7); $MarchDate=14 - (floor (1 + $year * 5 / 4) % 7); $NovemberDate=7 - (floor (1 + $year * 5 / 4) % 7); $dstMonth1=($year>2006)?3:4; $dstMonth2=($year>2006)?11:10; $dstDay1 =($year>2006)?$MarchDate:$AprilDate; $dstDay2 =($year>2006)?$NovemberDate:$OctoberDate; $destStart=mktime($dstTime,0,0,$dstMonth1,$dstDay1,$year); $destEnd=mktime($dstTime,0,0,$dstMonth2,$dstDay2,$year); return; } // has to eu then.. $dstTime=1; $MarchDateEU=(31-(floor ($year * 5 / 4) + 4) % 7); $OctoberDateEU=(31-(floor ($year * 5 / 4) + 1) % 7); $destStart=mktime($dstTime,0,0,3,$MarchDateEU,$year); $destEnd=mktime($dstTime,0,0,10,$OctoberDateEU,$year); }

« previous php.notes (#117496) next »