xref: /PHP-7.1/ext/date/tests/bug34771.phpt (revision b3a48855)
1--TEST--
2Bug #34771 (strtotime() fails with 1-12am/pm)
3--FILE--
4<?php
5date_default_timezone_set("UTC");
6
7$tests = array(
8	'12am', '1am', '1pm',
9	'12a.m.', '1a.m.', '1p.m.',
10	'12:00am', '1:00am', '1:00pm',
11	'12:00a.m.', '1:00a.m.', '1:00p.m.'
12);
13
14foreach ($tests as $test) {
15	$t = strtotime("2005-12-22 ". $test);
16	printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
17}
18
19?>
20--EXPECT--
2112am       => 2005-12-22T00:00:00+0000
221am        => 2005-12-22T01:00:00+0000
231pm        => 2005-12-22T13:00:00+0000
2412a.m.     => 2005-12-22T00:00:00+0000
251a.m.      => 2005-12-22T01:00:00+0000
261p.m.      => 2005-12-22T13:00:00+0000
2712:00am    => 2005-12-22T00:00:00+0000
281:00am     => 2005-12-22T01:00:00+0000
291:00pm     => 2005-12-22T13:00:00+0000
3012:00a.m.  => 2005-12-22T00:00:00+0000
311:00a.m.   => 2005-12-22T01:00:00+0000
321:00p.m.   => 2005-12-22T13:00:00+0000
33