DateTime::createFromFormat not handling Timezone
Open
php5 incompatibility
php7 incompatibility
probably easy
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
When creating a DateTime with createFromFormat it ignores the timezone specified within the format.
``` php
date_default_timezone_set('UTC');
$time = DateTime::createFromFormat('Y-m-d\TH:i:s.uP', '2015-03-22T11:42:25.943Z');
var_dump($time->getTimezone()->getName());
$time = DateTime::createFromFormat('Y-m-d\TH:i:s.uP', '2015-03-22T11:42:25.943+02:00');
var_dump($time->getTimezone()->getName());
```
**PHP 5.5**
```
Runtime: PHP 5.5.9-1ubuntu4.9 with Xdebug 2.2.3:
string(1) "Z"
string(6) "+02:00"
```
**HHVM**
```
Runtime: HHVM 3.9.1
string(3) "UTC"
string(3) "UTC"
```
Contributor guide
Assessment
This issue has not been assessed yet.