xref: /PHP-7.4/ext/date/tests/bug33415-2.phpt (revision 9733d49e)
1--TEST--
2Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts)
3--FILE--
4<?php
5date_default_timezone_set('Africa/Bujumbura');
6
7print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
8have a DST or timezone transition.\n";
9$tStamp = mktime (17, 17, 17, 1, 1, 1970);
10print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
11$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
12print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
13print "wanted=Wednesday            00:00:00\n\n";
14
15print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n";
16date_default_timezone_set('Asia/Thimbu');
17$tStamp = mktime (17, 17, 17, 1, 6476, 1970);
18print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
19$strtotime_tstamp = strtotime("next Thursday", $tStamp);
20print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
21print "wanted=Thursday            00:30:00\n\n";
22
23print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
24appear to have a DST or timezone transition.\n";
25date_default_timezone_set('Indian/Cocos');
26$tStamp = mktime (17, 17, 17, 1, 1, 1970);
27print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
28$strtotime_tstamp = strtotime("next Thursday", $tStamp);
29print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
30print "wanted=Thursday            00:00:00\n\n";
31
32print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
33not appear to have a DST or timezone transition.\n";
34date_default_timezone_set('Africa/Lubumbashi');
35$tStamp = mktime (17, 17, 17, 1, 1, 1970);
36print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
37$strtotime_tstamp = strtotime("next Saturday", $tStamp);
38print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
39print "wanted=Saturday            00:00:00\n\n";
40
41print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n";
42date_default_timezone_set('Asia/Kashgar');
43$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
44print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
45$strtotime_tstamp = strtotime("next Thursday", $tStamp);
46print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
47print "wanted=Thursday            03:00:00\n\n";
48
49print "TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does
50not appear to have a DST or timezone transition.\n";
51date_default_timezone_set('Indian/Christmas');
52$tStamp = mktime (17, 17, 17, 1, 1, 1970);
53print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
54$strtotime_tstamp = strtotime("next Sunday", $tStamp);
55print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
56print "wanted=Sunday            00:00:00\n\n";
57
58print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n";
59date_default_timezone_set('America/Santo_Domingo');
60$tStamp = mktime (17, 17, 17, 1, 291, 1970);
61print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
62$strtotime_tstamp = strtotime("next Sunday", $tStamp);
63print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
64print "wanted=Sunday            00:30:00\n\n";
65
66print "TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not
67appear to have a DST or timezone transition.\n";
68date_default_timezone_set('Pacific/Truk');
69$tStamp = mktime (17, 17, 17, 1, 1, 1970);
70print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
71$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
72print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
73print "wanted=Tuesday            00:00:00\n\n";
74
75print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does
76not appear to have a DST or timezone transition.\n";
77date_default_timezone_set('Pacific/Ponape');
78$tStamp = mktime (17, 17, 17, 1, 1, 1970);
79print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
80$strtotime_tstamp = strtotime("next Monday", $tStamp);
81print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
82print "wanted=Monday            00:00:00\n\n";
83
84print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n";
85date_default_timezone_set('America/Scoresbysund');
86$tStamp = mktime (17, 17, 17, 1, 4099, 1970);
87print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
88$strtotime_tstamp = strtotime("next Sunday", $tStamp);
89print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
90print "wanted=Sunday            02:00:00\n\n";
91
92print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
93date_default_timezone_set('Asia/Tehran');
94$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
95print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
96$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
97print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
98print "wanted=Tuesday            00:30:00\n\n";
99
100print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
101not appear to have a DST or timezone transition.\n";
102date_default_timezone_set('Pacific/Tarawa');
103$tStamp = mktime (17, 17, 17, 1, 1, 1970);
104print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
105$strtotime_tstamp = strtotime("next Monday", $tStamp);
106print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
107print "wanted=Monday            00:00:00\n\n";
108
109print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
110date_default_timezone_set('Africa/Monrovia');
111$tStamp = mktime (17, 17, 17, 1, 730, 1970);
112print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
113$strtotime_tstamp = strtotime("next Friday", $tStamp);
114print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
115print "wanted=Friday            00:44:30\n\n";
116
117print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
118date_default_timezone_set('Asia/Katmandu');
119$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
120print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
121$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
122print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
123print "wanted=Wednesday            00:15:00\n\n";
124
125print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
126date_default_timezone_set('Pacific/Nauru');
127$tStamp = mktime (17, 17, 17, 2, 3, 1979);
128print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
129$strtotime_tstamp = strtotime("next Saturday +2 hours", $tStamp);
130print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
131print "wanted=Saturday            02:30:00\n\n";
132
133print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
134or timezone transition.\n";
135date_default_timezone_set('Pacific/Port_Moresby');
136$tStamp = mktime (17, 17, 17, 1, 1, 1970);
137print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
138$strtotime_tstamp = strtotime("next Thursday", $tStamp);
139print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
140print "wanted=Thursday            00:00:00\n\n";
141
142print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n";
143date_default_timezone_set('America/Miquelon');
144$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
145print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
146$strtotime_tstamp = strtotime("next Thursday", $tStamp);
147print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
148print "wanted=Thursday            01:00:00\n\n";
149
150print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
151timezone transition.\n";
152date_default_timezone_set('Pacific/Palau');
153$tStamp = mktime (17, 17, 17, 1, 1, 1970);
154print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
155$strtotime_tstamp = strtotime("next Saturday", $tStamp);
156print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
157print "wanted=Saturday            00:00:00\n\n";
158
159print "TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does
160not appear to have a DST or timezone transition.\n";
161date_default_timezone_set('Pacific/Funafuti');
162$tStamp = mktime (17, 17, 17, 1, 1, 1970);
163print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
164$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
165print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
166print "wanted=Wednesday            00:00:00\n\n";
167
168print "TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not
169appear to have a DST or timezone transition.\n";
170date_default_timezone_set('Pacific/Wake');
171$tStamp = mktime (17, 17, 17, 1, 1, 1970);
172print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
173$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
174print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
175print "wanted=Tuesday            00:00:00\n\n";
176
177print "TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does
178not appear to have a DST or timezone transition.\n";
179date_default_timezone_set('Pacific/Wallis');
180$tStamp = mktime (17, 17, 17, 1, 1, 1970);
181print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
182$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
183print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
184print "wanted=Tuesday            00:00:00\n\n";
185
186print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
187date_default_timezone_set('America/Paramaribo');
188$tStamp = mktime (17, 17, 17, 1, 5381, 1970);
189print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
190$strtotime_tstamp = strtotime("next Monday", $tStamp);
191print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
192print "wanted=Monday            00:30:00\n\n";
193
194?>
195--EXPECT--
196TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
197have a DST or timezone transition.
198tStamp=Thursday 1970-01-01 17:17:17 CAT 0
199result=Wednesday 1970-01-07 00:00:00 CAT 0
200wanted=Wednesday            00:00:00
201
202TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes
203tStamp=Thursday 1987-09-24 17:17:17 +0530 0
204result=Thursday 1987-10-01 00:30:00 +06 0
205wanted=Thursday            00:30:00
206
207TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
208appear to have a DST or timezone transition.
209tStamp=Thursday 1970-01-01 17:17:17 +0630 0
210result=Thursday 1970-01-08 00:00:00 +0630 0
211wanted=Thursday            00:00:00
212
213TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
214not appear to have a DST or timezone transition.
215tStamp=Thursday 1970-01-01 17:17:17 CAT 0
216result=Saturday 1970-01-03 00:00:00 CAT 0
217wanted=Saturday            00:00:00
218
219TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
220tStamp=Thursday 1980-04-24 17:17:17 +06 0
221result=Thursday 1980-05-01 00:00:00 +06 0
222wanted=Thursday            03:00:00
223
224TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does
225not appear to have a DST or timezone transition.
226tStamp=Thursday 1970-01-01 17:17:17 +07 0
227result=Sunday 1970-01-04 00:00:00 +07 0
228wanted=Sunday            00:00:00
229
230TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes
231tStamp=Sunday 1970-10-18 17:17:17 EST 0
232result=Sunday 1970-10-25 00:30:00 -0430 1
233wanted=Sunday            00:30:00
234
235TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not
236appear to have a DST or timezone transition.
237tStamp=Thursday 1970-01-01 17:17:17 +10 0
238result=Tuesday 1970-01-06 00:00:00 +10 0
239wanted=Tuesday            00:00:00
240
241TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does
242not appear to have a DST or timezone transition.
243tStamp=Thursday 1970-01-01 17:17:17 +11 0
244result=Monday 1970-01-05 00:00:00 +11 0
245wanted=Monday            00:00:00
246
247TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes
248tStamp=Sunday 1981-03-22 17:17:17 -02 0
249result=Sunday 1981-03-29 02:00:00 +00 1
250wanted=Sunday            02:00:00
251
252TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes
253tStamp=Tuesday 1977-10-25 17:17:17 +0330 0
254result=Tuesday 1977-11-01 00:30:00 +04 0
255wanted=Tuesday            00:30:00
256
257TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
258not appear to have a DST or timezone transition.
259tStamp=Thursday 1970-01-01 17:17:17 +12 0
260result=Monday 1970-01-05 00:00:00 +12 0
261wanted=Monday            00:00:00
262
263TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes
264tStamp=Friday 1971-12-31 17:17:17 MMT 0
265result=Friday 1972-01-07 00:44:30 GMT 0
266wanted=Friday            00:44:30
267
268TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes
269tStamp=Wednesday 1985-12-25 17:17:17 +0530 0
270result=Wednesday 1986-01-01 00:15:00 +0545 0
271wanted=Wednesday            00:15:00
272
273TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes
274tStamp=Saturday 1979-02-03 17:17:17 +1130 0
275result=Saturday 1979-02-10 02:30:00 +12 0
276wanted=Saturday            02:30:00
277
278TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
279or timezone transition.
280tStamp=Thursday 1970-01-01 17:17:17 +10 0
281result=Thursday 1970-01-08 00:00:00 +10 0
282wanted=Thursday            00:00:00
283
284TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes
285tStamp=Thursday 1980-04-24 17:17:17 AST 0
286result=Thursday 1980-05-01 01:00:00 -03 0
287wanted=Thursday            01:00:00
288
289TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
290timezone transition.
291tStamp=Thursday 1970-01-01 17:17:17 +09 0
292result=Saturday 1970-01-03 00:00:00 +09 0
293wanted=Saturday            00:00:00
294
295TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does
296not appear to have a DST or timezone transition.
297tStamp=Thursday 1970-01-01 17:17:17 +12 0
298result=Wednesday 1970-01-07 00:00:00 +12 0
299wanted=Wednesday            00:00:00
300
301TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not
302appear to have a DST or timezone transition.
303tStamp=Thursday 1970-01-01 17:17:17 +12 0
304result=Tuesday 1970-01-06 00:00:00 +12 0
305wanted=Tuesday            00:00:00
306
307TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does
308not appear to have a DST or timezone transition.
309tStamp=Thursday 1970-01-01 17:17:17 +12 0
310result=Tuesday 1970-01-06 00:00:00 +12 0
311wanted=Tuesday            00:00:00
312
313TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes
314tStamp=Monday 1984-09-24 17:17:17 -0330 0
315result=Monday 1984-10-01 00:30:00 -03 0
316wanted=Monday            00:30:00
317