bug33414-2.phpt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. --TEST--
  2. Bug #33414 [2] (Comprehensive list of incorrect days returned after strotime() / date() tests)
  3. --FILE--
  4. <?php
  5. print "TZ=Pacific/Rarotonga - wrong day.\n";
  6. date_default_timezone_set("Pacific/Rarotonga");
  7. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  8. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  9. $strtotime_tstamp = strtotime("next Tuesday", $tStamp);
  10. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  11. print "wanted=Tuesday 00:00:00\n\n";
  12. print "TZ=Atlantic/South_Georgia - wrong day.\n";
  13. date_default_timezone_set("Atlantic/South_Georgia");
  14. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  15. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  16. $strtotime_tstamp = strtotime("next Tuesday", $tStamp);
  17. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  18. print "wanted=Tuesday 00:00:00\n\n";
  19. print "TZ=America/Port-au-Prince - wrong day.\n";
  20. date_default_timezone_set("America/Port-au-Prince");
  21. $tStamp = mktime (17, 17, 17, 1, 12871, 1970);
  22. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  23. $strtotime_tstamp = strtotime("next Monday", $tStamp);
  24. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  25. print "wanted=Monday 00:00:00\n\n";
  26. print "TZ=Pacific/Enderbury - wrong day, off by 2 days.\n";
  27. date_default_timezone_set("Pacific/Enderbury");
  28. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  29. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  30. $strtotime_tstamp = strtotime("next Monday", $tStamp);
  31. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  32. print "wanted=Monday 00:00:00\n\n";
  33. print "TZ=Pacific/Kiritimati - wrong day, off by 2 days.\n";
  34. date_default_timezone_set("Pacific/Kiritimati");
  35. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  36. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  37. $strtotime_tstamp = strtotime("next Monday", $tStamp);
  38. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  39. print "wanted=Monday 00:00:00\n\n";
  40. print "TZ=America/Managua - wrong day.\n";
  41. date_default_timezone_set("America/Managua");
  42. $tStamp = mktime (17, 17, 17, 1, 12879, 1970);
  43. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  44. $strtotime_tstamp = strtotime("next Tuesday", $tStamp);
  45. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  46. print "wanted=Tuesday 00:00:00\n\n";
  47. print "TZ=Pacific/Pitcairn - wrong day.\n";
  48. date_default_timezone_set("Pacific/Pitcairn");
  49. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  50. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  51. $strtotime_tstamp = strtotime("next Wednesday", $tStamp);
  52. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  53. print "wanted=Wednesday 00:00:00\n\n";
  54. print "TZ=Pacific/Fakaofo - wrong day.\n";
  55. date_default_timezone_set("Pacific/Fakaofo");
  56. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  57. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  58. $strtotime_tstamp = strtotime("next Saturday", $tStamp);
  59. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  60. print "wanted=Saturday 00:00:00\n\n";
  61. print "TZ=Pacific/Johnston - wrong day.\n";
  62. date_default_timezone_set("Pacific/Johnston");
  63. $tStamp = mktime (17, 17, 17, 1, 1, 1970);
  64. print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
  65. $strtotime_tstamp = strtotime("next Friday", $tStamp);
  66. print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
  67. print "wanted=Friday 00:00:00\n\n";
  68. ?>
  69. --EXPECT--
  70. TZ=Pacific/Rarotonga - wrong day.
  71. tStamp=Thursday 1970-01-01 17:17:17 -1030 0
  72. result=Tuesday 1970-01-06 00:00:00 -1030 0
  73. wanted=Tuesday 00:00:00
  74. TZ=Atlantic/South_Georgia - wrong day.
  75. tStamp=Thursday 1970-01-01 17:17:17 -02 0
  76. result=Tuesday 1970-01-06 00:00:00 -02 0
  77. wanted=Tuesday 00:00:00
  78. TZ=America/Port-au-Prince - wrong day.
  79. tStamp=Monday 2005-03-28 17:17:17 EST 0
  80. result=Monday 2005-04-04 00:00:00 EDT 1
  81. wanted=Monday 00:00:00
  82. TZ=Pacific/Enderbury - wrong day, off by 2 days.
  83. tStamp=Thursday 1970-01-01 17:17:17 -12 0
  84. result=Monday 1970-01-05 00:00:00 -12 0
  85. wanted=Monday 00:00:00
  86. TZ=Pacific/Kiritimati - wrong day, off by 2 days.
  87. tStamp=Thursday 1970-01-01 17:17:17 -1040 0
  88. result=Monday 1970-01-05 00:00:00 -1040 0
  89. wanted=Monday 00:00:00
  90. TZ=America/Managua - wrong day.
  91. tStamp=Tuesday 2005-04-05 17:17:17 CST 0
  92. result=Tuesday 2005-04-12 00:00:00 CDT 1
  93. wanted=Tuesday 00:00:00
  94. TZ=Pacific/Pitcairn - wrong day.
  95. tStamp=Thursday 1970-01-01 17:17:17 -0830 0
  96. result=Wednesday 1970-01-07 00:00:00 -0830 0
  97. wanted=Wednesday 00:00:00
  98. TZ=Pacific/Fakaofo - wrong day.
  99. tStamp=Thursday 1970-01-01 17:17:17 -11 0
  100. result=Saturday 1970-01-03 00:00:00 -11 0
  101. wanted=Saturday 00:00:00
  102. TZ=Pacific/Johnston - wrong day.
  103. tStamp=Thursday 1970-01-01 17:17:17 HST 0
  104. result=Friday 1970-01-02 00:00:00 HST 0
  105. wanted=Friday 00:00:00