note 108578 added to datetime.settimezone

From: Date: Tue, 08 May 2012 13:59:45 +0000
Subject: note 108578 added to datetime.settimezone
Groups: php.notes 
Request: Send a blank email to php-notes+get-187522@lists.php.net to get a copy of this message
I found unexpected behaviour when passing a timestamp. timezone seems to always be GMT+0000 unless setTimezone() is set. <?php $MNTTZ = new DateTimeZone('America/Denver'); $ts = 1336476757; $dt = new DateTime("@$ts", $MNTTZ); var_dump($dt->format('T'), $dt->format('U')); $dt->setTimezone($MNTTZ); var_dump($dt->format('T'), $dt->format('U')); /** Output: string(8) "GMT+0000" string(10) "1336476757" string(3) "MDT" string(10) "1336476757" **/ ?> ---- Server IP: 69.147.83.197 Probable Submitter: 90.221.76.218 ---- Manual Page -- http://www.php.net/manual/en/datetime.settimezone.php Edit -- https://master.php.net/note/edit/108578 Del: integrated -- https://master.php.net/note/delete/108578/integrated Del: useless -- https://master.php.net/note/delete/108578/useless Del: bad code -- https://master.php.net/note/delete/108578/bad+code Del: spam -- https://master.php.net/note/delete/108578/spam Del: non-english -- https://master.php.net/note/delete/108578/non-english Del: in docs -- https://master.php.net/note/delete/108578/in+docs Del: other reasons-- https://master.php.net/note/delete/108578 Reject -- https://master.php.net/note/reject/108578 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187522) next »