xref: /PHP-7.1/ext/date/tests/bug73426.phpt (revision 8467c5c9)
1--TEST--
2Bug #73426 (createFromFormat with 'z' format char results in incorrect time)
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$date = '2016 12:00:00 15';
8$format = 'Y H:i:s z';
9var_dump(DateTime::createFromFormat($format, $date));
10
11$date = '16 12:00:00 2016';
12$format = 'z H:i:s Y';
13var_dump(DateTime::createFromFormat($format, $date));
14
15?>
16--EXPECTF--
17object(DateTime)#%d (%d) {
18  ["date"]=>
19  string(26) "2016-01-16 12:00:00.000000"
20  ["timezone_type"]=>
21  int(3)
22  ["timezone"]=>
23  string(3) "UTC"
24}
25object(DateTime)#%d (%d) {
26  ["date"]=>
27  string(26) "2016-01-17 12:00:00.000000"
28  ["timezone_type"]=>
29  int(3)
30  ["timezone"]=>
31  string(3) "UTC"
32}
33