On Mon, 9 Sep 2013, Martin Keckeis wrote:

> If you use a deprecated Timezone somewhere and don't know it, it's hard to
> track down...(no exception)
> I only found it "randomly" today, that i've used it there and all time data
> in the database are not correct...
> 
> If you use something like:
> \DateTime::createFromFormat('Y-m-d H:i:s', '2013-09-09 14:49:00', new
> DateTimeZone('CET'))
> 
> Just the default timezone from ini will be used and therefor the dateTime
> value is wrong if you save it or display it somewhere...

That is not true. CET is actually mapped to Europe/Berlin. This mapping 
was made specifically for BC reasons.

derick@whisky:~ $ php
<?php
$a = \DateTime::createFromFormat('Y-m-d H:i:s', '2013-09-09 14:49:00' );
var_dump( $a );
?>
class DateTime#1 (3) {
  public $date =>
  string(19) "2013-09-09 14:49:00"
  public $timezone_type =>
  int(3)
  public $timezone =>
  string(13) "Europe/London"
}

derick@whisky:~ $ php
<?php
$a = \DateTime::createFromFormat('Y-m-d H:i:s', '2013-09-09 14:49:00', new 
DateTimeZone('CET')); 
var_dump( $a );
?>
class DateTime#2 (3) {
  public $date =>
  string(19) "2013-09-09 14:49:00"
  public $timezone_type =>
  int(3)
  public $timezone =>
  string(13) "Europe/Berlin"
}


cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to