We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e7a7065 commit fc87715Copy full SHA for fc87715
ext/date/tests/bug74652.phpt
@@ -0,0 +1,30 @@
1
+--TEST--
2
+Test for bug #74652: Incomplete dates
3
+--INI--
4
+date.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
+
17
+foreach ( $formats as $format )
18
+{
19
+ $dt = new DateTimeImmutable( $format );
20
+ echo $dt->format( 'Y-m-d H:i:s' ), "\n";
21
+}
22
+?>
23
+--EXPECT--
24
+2017-03-25 10:52:09
25
+2017-03-25 10:52:00
26
+2017-03-25 10:00:00
27
+2017-03-25 00:00:00
28
+2017-03-01 00:00:00
29
+2017-02-11 00:00:00
30
+2017-02-12 00:00:00
0 commit comments