note 113670 added to datetimezone.gettransitions

From: Date: Thu, 14 Nov 2013 05:04:46 +0000
Subject: note 113670 added to datetimezone.gettransitions
Groups: php.notes 
Request: Send a blank email to php-notes+get-197512@lists.php.net to get a copy of this message
This function will work in PHP < 5.3 : /** returns an array with two elements for spring and fall DST in a given year * * @param integer $year * @param string $tz timezone * @return array **/ function getTransitionsForYear($year=null, $tz = null){ if(!$year) $year=date("Y"); if (!$tz) $tz = date_default_timezone_get(); $timeZone = new DateTimeZone($tz); $transitions = $timeZone->getTransitions(mktime(0, 0, 0, 1, 1, $year)); return array_slice($transitions, 1, 2); } ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/datetimezone.gettransitions.php Edit -- https://master.php.net/note/edit/113670 Del: integrated -- https://master.php.net/note/delete/113670/integrated Del: useless -- https://master.php.net/note/delete/113670/useless Del: bad code -- https://master.php.net/note/delete/113670/bad+code Del: spam -- https://master.php.net/note/delete/113670/spam Del: non-english -- https://master.php.net/note/delete/113670/non-english Del: in docs -- https://master.php.net/note/delete/113670/in+docs Del: other reasons-- https://master.php.net/note/delete/113670 Reject -- https://master.php.net/note/reject/113670 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197512) next »