note 91799 modified in datetime.settimezone by danbrown

From: Date: Thu, 25 Jun 2009 21:02:19 +0000
Subject: note 91799 modified in datetime.settimezone by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157512@lists.php.net to get a copy of this message
In my setup setTimezone() does modify the date, as well as the TZ. Code: <?php $dt_obj = new DateTime('2009-06-25 12:00:00'); echo $dt_obj->format(DATE_RFC822) . "\n"; $dt_obj->setTimezone(new DateTimeZone('GMT')); echo $dt_obj->format(DATE_RFC822); ?> Output: Thu, 25 Jun 09 12:00:00 -0400 Thu, 25 Jun 09 16:00:00 +0000 --was-- In my setup setTimezone() does modify the date, as well as the TZ. Code: $dt_obj = new DateTime('2009-06-25 12:00:00'); echo $dt_obj->format(DATE_RFC822) . "\n"; $dt_obj->setTimezone(new DateTimeZone('GMT')); echo $dt_obj->format(DATE_RFC822); Output: Thu, 25 Jun 09 12:00:00 -0400 Thu, 25 Jun 09 16:00:00 +0000 http://php.net/manual/en/datetime.settimezone.php

« previous php.notes (#157512) next »