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