note 96574 added to datetimezone.gettransitions

From: Date: Fri, 05 Mar 2010 19:19:18 +0000
Subject: note 96574 added to datetimezone.gettransitions
Groups: php.notes 
Request: Send a blank email to php-notes+get-166715@lists.php.net to get a copy of this message
Getting a timezone's offset and other data at a specified point in time (now, for example) using the new PHP5.3 parameters: $theTime = time(); # specific date/time we're checking, in epoch seconds. $tz = new DateTimeZone('America/Los_Angeles'); $transition = $tz-getTransitions($theTime,$theTime); # only one array should be returned into $transition. Now get the data: $offset = $transition[0]['offset']; $abbr = $transition[0]['abbr']; Before PHP5.3, you'd have to loop through all of the Transitions up until the current point in time, which would be a very inefficient process. ---- Server IP: 64.71.164.2 Probable Submitter: 76.28.238.159 ---- Manual Page -- http://www.php.net/manual/en/datetimezone.gettransitions.php Edit -- https://master.php.net/note/edit/96574 Del: integrated -- https://master.php.net/note/delete/96574/integrated Del: useless -- https://master.php.net/note/delete/96574/useless Del: bad code -- https://master.php.net/note/delete/96574/bad+code Del: spam -- https://master.php.net/note/delete/96574/spam Del: non-english -- https://master.php.net/note/delete/96574/non-english Del: in docs -- https://master.php.net/note/delete/96574/in+docs Del: other reasons-- https://master.php.net/note/delete/96574 Reject -- https://master.php.net/note/reject/96574 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166715) next »