xref: /PHP-7.3/ext/date/tests/date-lenient.phpt (revision 91ad5e73)
1--TEST--
2Test for + character in date format
3--FILE--
4<?php
5$date = "06/08/04 12:00";
6print_r( date_parse_from_format( 'm/d/y', $date ) );
7print_r( date_parse_from_format( 'm/d/y+', $date ) );
8print_r( date_parse_from_format( '+m/d/y', $date ) );
9print_r( date_parse_from_format( 'm/d/y++', $date ) );
10
11$date = "06/08/04";
12print_r( date_parse_from_format( 'm/d/y+', $date ) );
13print_r( date_parse_from_format( '+m/d/y', $date ) );
14
15?>
16--EXPECT--
17Array
18(
19    [year] => 2004
20    [month] => 6
21    [day] => 8
22    [hour] =>
23    [minute] =>
24    [second] =>
25    [fraction] =>
26    [warning_count] => 0
27    [warnings] => Array
28        (
29        )
30
31    [error_count] => 1
32    [errors] => Array
33        (
34            [8] => Trailing data
35        )
36
37    [is_localtime] =>
38)
39Array
40(
41    [year] => 2004
42    [month] => 6
43    [day] => 8
44    [hour] =>
45    [minute] =>
46    [second] =>
47    [fraction] =>
48    [warning_count] => 1
49    [warnings] => Array
50        (
51            [8] => Trailing data
52        )
53
54    [error_count] => 0
55    [errors] => Array
56        (
57        )
58
59    [is_localtime] =>
60)
61Array
62(
63    [year] => 2004
64    [month] => 6
65    [day] => 8
66    [hour] =>
67    [minute] =>
68    [second] =>
69    [fraction] =>
70    [warning_count] => 1
71    [warnings] => Array
72        (
73            [8] => Trailing data
74        )
75
76    [error_count] => 0
77    [errors] => Array
78        (
79        )
80
81    [is_localtime] =>
82)
83Array
84(
85    [year] => 2004
86    [month] => 6
87    [day] => 8
88    [hour] =>
89    [minute] =>
90    [second] =>
91    [fraction] =>
92    [warning_count] => 1
93    [warnings] => Array
94        (
95            [8] => Trailing data
96        )
97
98    [error_count] => 0
99    [errors] => Array
100        (
101        )
102
103    [is_localtime] =>
104)
105Array
106(
107    [year] => 2004
108    [month] => 6
109    [day] => 8
110    [hour] =>
111    [minute] =>
112    [second] =>
113    [fraction] =>
114    [warning_count] => 0
115    [warnings] => Array
116        (
117        )
118
119    [error_count] => 0
120    [errors] => Array
121        (
122        )
123
124    [is_localtime] =>
125)
126Array
127(
128    [year] => 2004
129    [month] => 6
130    [day] => 8
131    [hour] =>
132    [minute] =>
133    [second] =>
134    [fraction] =>
135    [warning_count] => 0
136    [warnings] => Array
137        (
138        )
139
140    [error_count] => 0
141    [errors] => Array
142        (
143        )
144
145    [is_localtime] =>
146)
147