note 99386 modified in datetime.settimezone by danbrown

From: Date: Sat, 14 Aug 2010 14:17:09 +0000
Subject: note 99386 modified in datetime.settimezone by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171677@lists.php.net to get a copy of this message
please note that using setTimezone setTimestamp setDate setTime etc.. will modify the original object, and the return value is $this $original = new DateTime("now"); $modified = $original->setTimezone(new DateTimezone("europe/rome")); echo $original === $modified ? "THE OBJECT IS THE SAME" : "OBJECTS ARE DIFFERENT"; so a datetime object is mutable --was-- please note that using setTimezone setTimestamp setDate setTime etc.. will modify the original object, and the return value is $this $original = new DateTime("now"); $modified = $original->setTimezone(new DateTimezone("europe/rome")); echo $original === $modified ? "THE OBJECT IS THE SAME" : "OBJECTS ARE DIFFERENT"; so a datetime object is mutable http://php.net/manual/en/datetime.settimezone.php

« previous php.notes (#171677) next »