Good, so I got angry myself. Of course, I'm the one who is wrong ...
To get it straight, I'll just pick up the bits that are relevant in the document here and.
The manual says:
// Using a UNIX timestamp. Notice the result is in the UTC time zone. $date = new DateTime('@946684800'); echo $date->format('Ymd H:i:sP') . "\n";
So, you can use setTimezone to get the time in your time zone again (what can you expect if your system is configured this way!):
$timezone = new DateTimeZone('Europe/Madrid'); $date->setTimezone(new DateTimeZone('Pacific/Chatham'));
note that
$date = new DateTime('@1306123200', new DateTimeZone('Europe/Madrid'));
misleading as you will be in UTC anyway! (and yes, this is very clearly indicated in the constructor's document. Therefore, be careful;)
Thanks @hakre Thanks everyone!
source share