xref: /PHP-7.3/ext/date/tests/bug74652.phpt (revision fc877159)
1--TEST--
2Test for bug #74652: Incomplete dates
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$formats = [
8	'2017-03-25 10:52:09',
9	'2017-03-25 10:52',
10	'2017-03-25 10am',
11	'2017-03-25',
12	'2017-03',
13	'2017.042',
14	'2017043',
15];
16
17foreach ( $formats as $format )
18{
19	$dt = new DateTimeImmutable( $format );
20	echo $dt->format( 'Y-m-d H:i:s' ), "\n";
21}
22?>
23--EXPECT--
242017-03-25 10:52:09
252017-03-25 10:52:00
262017-03-25 10:00:00
272017-03-25 00:00:00
282017-03-01 00:00:00
292017-02-11 00:00:00
302017-02-12 00:00:00
31