xref: /PHP-7.0/ext/date/tests/bug33415-2.phpt (revision 1f8fc0fb)
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=America/Guyana - Is it OK for this to be 0:45 AM? yes\n";
93date_default_timezone_set('America/Guyana');
94$tStamp = mktime (17, 17, 17, 1, 2031, 1970);
95print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
96$strtotime_tstamp = strtotime("next Thursday", $tStamp);
97print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
98print "wanted=Thursday            00:45:00\n\n";
99
100print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
101date_default_timezone_set('Asia/Tehran');
102$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
103print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
104$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
105print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
106print "wanted=Tuesday            00:30:00\n\n";
107
108print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
109not appear to have a DST or timezone transition.\n";
110date_default_timezone_set('Pacific/Tarawa');
111$tStamp = mktime (17, 17, 17, 1, 1, 1970);
112print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
113$strtotime_tstamp = strtotime("next Monday", $tStamp);
114print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
115print "wanted=Monday            00:00:00\n\n";
116
117print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
118date_default_timezone_set('Africa/Monrovia');
119$tStamp = mktime (17, 17, 17, 1, 730, 1970);
120print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
121$strtotime_tstamp = strtotime("next Friday", $tStamp);
122print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
123print "wanted=Friday            00:44:30\n\n";
124
125print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
126date_default_timezone_set('Asia/Katmandu');
127$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
128print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
129$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
130print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
131print "wanted=Wednesday            00:15:00\n\n";
132
133print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
134date_default_timezone_set('Pacific/Nauru');
135$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
136print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
137$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
138print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
139print "wanted=Tuesday            00:30:00\n\n";
140
141print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
142date_default_timezone_set('Pacific/Niue');
143$tStamp = mktime (17, 17, 17, 1, 3189, 1970);
144print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
145$strtotime_tstamp = strtotime("next Sunday", $tStamp);
146print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
147print "wanted=Sunday            00:30:00\n\n";
148
149print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
150or timezone transition.\n";
151date_default_timezone_set('Pacific/Port_Moresby');
152$tStamp = mktime (17, 17, 17, 1, 1, 1970);
153print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
154$strtotime_tstamp = strtotime("next Thursday", $tStamp);
155print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
156print "wanted=Thursday            00:00:00\n\n";
157
158print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n";
159date_default_timezone_set('America/Miquelon');
160$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
161print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
162$strtotime_tstamp = strtotime("next Thursday", $tStamp);
163print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
164print "wanted=Thursday            01:00:00\n\n";
165
166print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
167timezone transition.\n";
168date_default_timezone_set('Pacific/Palau');
169$tStamp = mktime (17, 17, 17, 1, 1, 1970);
170print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
171$strtotime_tstamp = strtotime("next Saturday", $tStamp);
172print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
173print "wanted=Saturday            00:00:00\n\n";
174
175print "TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does
176not appear to have a DST or timezone transition.\n";
177date_default_timezone_set('Pacific/Funafuti');
178$tStamp = mktime (17, 17, 17, 1, 1, 1970);
179print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
180$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
181print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
182print "wanted=Wednesday            00:00:00\n\n";
183
184print "TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not
185appear to have a DST or timezone transition.\n";
186date_default_timezone_set('Pacific/Wake');
187$tStamp = mktime (17, 17, 17, 1, 1, 1970);
188print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
189$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
190print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
191print "wanted=Tuesday            00:00:00\n\n";
192
193print "TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does
194not appear to have a DST or timezone transition.\n";
195date_default_timezone_set('Pacific/Wallis');
196$tStamp = mktime (17, 17, 17, 1, 1, 1970);
197print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
198$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
199print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
200print "wanted=Tuesday            00:00:00\n\n";
201
202print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
203date_default_timezone_set('America/Paramaribo');
204$tStamp = mktime (17, 17, 17, 1, 5381, 1970);
205print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
206$strtotime_tstamp = strtotime("next Monday", $tStamp);
207print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
208print "wanted=Monday            00:30:00\n\n";
209
210?>
211--EXPECTF--
212TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
213have a DST or timezone transition.
214tStamp=Thursday 1970-01-01 17:17:17 CAT 0
215result=Wednesday 1970-01-07 00:00:00 CAT 0
216wanted=Wednesday            00:00:00
217
218TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes
219tStamp=Thursday 1987-09-24 17:17:17 +0530 0
220result=Thursday 1987-10-01 00:30:00 +06 0
221wanted=Thursday            00:30:00
222
223TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
224appear to have a DST or timezone transition.
225tStamp=Thursday 1970-01-01 17:17:17 +0630 0
226result=Thursday 1970-01-08 00:00:00 +0630 0
227wanted=Thursday            00:00:00
228
229TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
230not appear to have a DST or timezone transition.
231tStamp=Thursday 1970-01-01 17:17:17 CAT 0
232result=Saturday 1970-01-03 00:00:00 CAT 0
233wanted=Saturday            00:00:00
234
235TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
236tStamp=Thursday 1980-04-24 17:17:17 +06 0
237result=Thursday 1980-05-01 00:00:00 +06 0
238wanted=Thursday            03:00:00
239
240TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does
241not appear to have a DST or timezone transition.
242tStamp=Thursday 1970-01-01 17:17:17 +07 0
243result=Sunday 1970-01-04 00:00:00 +07 0
244wanted=Sunday            00:00:00
245
246TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes
247tStamp=Sunday 1970-10-18 17:17:17 EST 0
248result=Sunday 1970-10-25 00:30:00 -0430 1
249wanted=Sunday            00:30:00
250
251TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not
252appear to have a DST or timezone transition.
253tStamp=Thursday 1970-01-01 17:17:17 +10 0
254result=Tuesday 1970-01-06 00:00:00 +10 0
255wanted=Tuesday            00:00:00
256
257TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does
258not appear to have a DST or timezone transition.
259tStamp=Thursday 1970-01-01 17:17:17 +11 0
260result=Monday 1970-01-05 00:00:00 +11 0
261wanted=Monday            00:00:00
262
263TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes
264tStamp=Sunday 1981-03-22 17:17:17 -02 0
265result=Sunday 1981-03-29 02:00:00 +00 1
266wanted=Sunday            02:00:00
267
268TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes
269tStamp=Thursday 1975-07-24 17:17:17 -0345 0
270result=Thursday 1975-07-31 00:45:00 -03 0
271wanted=Thursday            00:45:00
272
273TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes
274tStamp=Tuesday 1977-10-25 17:17:17 +0330 0
275result=Tuesday 1977-11-01 00:30:00 +04 0
276wanted=Tuesday            00:30:00
277
278TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
279not appear to have a DST or timezone transition.
280tStamp=Thursday 1970-01-01 17:17:17 +12 0
281result=Monday 1970-01-05 00:00:00 +12 0
282wanted=Monday            00:00:00
283
284TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes
285tStamp=Friday 1971-12-31 17:17:17 MMT 0
286result=Friday 1972-01-07 00:44:30 GMT 0
287wanted=Friday            00:44:30
288
289TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes
290tStamp=Wednesday 1985-12-25 17:17:17 +0530 0
291result=Wednesday 1986-01-01 00:15:00 +0545 0
292wanted=Wednesday            00:15:00
293
294TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes
295tStamp=Tuesday 1979-04-24 17:17:17 +1130 0
296result=Tuesday 1979-05-01 00:30:00 +12 0
297wanted=Tuesday            00:30:00
298
299TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes
300tStamp=Sunday 1978-09-24 17:17:17 -1130 0
301result=Sunday 1978-10-01 00:30:00 -11 0
302wanted=Sunday            00:30:00
303
304TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
305or timezone transition.
306tStamp=Thursday 1970-01-01 17:17:17 +10 0
307result=Thursday 1970-01-08 00:00:00 +10 0
308wanted=Thursday            00:00:00
309
310TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes
311tStamp=Thursday 1980-04-24 17:17:17 AST 0
312result=Thursday 1980-05-01 01:00:00 -03 0
313wanted=Thursday            01:00:00
314
315TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
316timezone transition.
317tStamp=Thursday 1970-01-01 17:17:17 +09 0
318result=Saturday 1970-01-03 00:00:00 +09 0
319wanted=Saturday            00:00:00
320
321TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does
322not appear to have a DST or timezone transition.
323tStamp=Thursday 1970-01-01 17:17:17 +12 0
324result=Wednesday 1970-01-07 00:00:00 +12 0
325wanted=Wednesday            00:00:00
326
327TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not
328appear to have a DST or timezone transition.
329tStamp=Thursday 1970-01-01 17:17:17 +12 0
330result=Tuesday 1970-01-06 00:00:00 +12 0
331wanted=Tuesday            00:00:00
332
333TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does
334not appear to have a DST or timezone transition.
335tStamp=Thursday 1970-01-01 17:17:17 +12 0
336result=Tuesday 1970-01-06 00:00:00 +12 0
337wanted=Tuesday            00:00:00
338
339TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes
340tStamp=Monday 1984-09-24 17:17:17 -0330 0
341result=Monday 1984-10-01 00:30:00 -03 0
342wanted=Monday            00:30:00
343