note 67084 added to function.mktime

From: Date: Sat, 03 Jun 2006 01:39:42 +0000
Subject: note 67084 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-113046@lists.php.net to get a copy of this message
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); } ---- Server IP: 64.71.164.2 Probable Submitter: 68.201.241.168 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/note/edit/67084 Del: integrated -- http://master.php.net/note/delete/67084/integrated Del: useless -- http://master.php.net/note/delete/67084/useless Del: bad code -- http://master.php.net/note/delete/67084/bad+code Del: spam -- http://master.php.net/note/delete/67084/spam Del: non-english -- http://master.php.net/note/delete/67084/non-english Del: in docs -- http://master.php.net/note/delete/67084/in+docs Del: other reasons-- http://master.php.net/note/delete/67084 Reject -- http://master.php.net/note/reject/67084 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#113046) next »