*** Testing DateTime::format() : usage variation - unexpected values to first argument $format***
-- int 0 --
-string(1) "0"
+unicode(1) "0"
-- int 1 --
-string(1) "1"
+unicode(1) "1"
-- int 12345 --
-string(5) "12345"
+unicode(5) "12345"
-- int -12345 --
-string(6) "-12345"
+unicode(6) "-12345"
-- float 10.5 --
-string(4) "10.5"
+unicode(4) "10.5"
-- float -10.5 --
-string(5) "-10.5"
+unicode(5) "-10.5"
-- float .5 --
-string(3) "0.5"
+unicode(3) "0.5"
-- empty array --
-Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, array given in %s on line %d
bool(false)
-- int indexed array --
-Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, array given in %s on line %d
bool(false)
-- associative array --
-Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, array given in %s on line %d
bool(false)
-- nested arrays --
-Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, array given in %s on line %d
bool(false)
-- uppercase NULL --
-string(0) ""
+unicode(0) ""
-- lowercase null --
-string(0) ""
+unicode(0) ""
-- lowercase true --
-string(1) "1"
+unicode(1) "1"
-- lowercase false --
-string(0) ""
+unicode(0) ""
-- uppercase TRUE --
-string(1) "1"
+unicode(1) "1"
-- uppercase FALSE --
-string(0) ""
+unicode(0) ""
-- empty string DQ --
-string(0) ""
+unicode(0) ""
-- empty string SQ --
-string(0) ""
+unicode(0) ""
-- string DQ --
-string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+unicode(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
-- string SQ --
-string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
+unicode(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710"
-- mixed case string --
-string(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722"
+unicode(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722"
-- heredoc --
-string(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14"
+unicode(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14"
-- instance of classWithToString --
-string(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031"
+unicode(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031"
-- instance of classWithoutToString --
-Warning: DateTime::format() expects parameter 1 to be string, object given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, object given in %s on line %d
bool(false)
-- undefined var --
-string(0) ""
+unicode(0) ""
-- unset var --
-string(0) ""
+unicode(0) ""
-- resource --
-Warning: DateTime::format() expects parameter 1 to be string, resource given in %s on line %d
+Warning: DateTime::format() expects parameter 1 to be binary string, resource given in %s on line %d
bool(false)
===DONE===
?>
--FILE--
<?php
-putenv("TZ=US/Eastern");
+date_default_timezone_set('US/Eastern');
if (date('T') == 'GMT') {
putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
}
Bug #14561 (strtotime() bug)
--FILE--
<?php
-putenv("TZ=GMT");
+date_default_timezone_set('GMT');
echo strtotime("19:30 Dec 17 2005"), "\n";
echo strtotime("Dec 17 19:30 2005"), "\n";
?>
Bug #17988 (strtotime handling of postgresql timestamps)
--FILE--
<?php
-putenv("TZ=GMT");
+date_default_timezone_set('GMT');
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeover)
--FILE--
<?php
- putenv("TZ=Europe/Amsterdam");
+ date_default_timezone_set('Europe/Amsterdam');
$tStamp = mktime (17, 17, 17, 10, 27, 2004);
echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
);
foreach ($tests as $test) {
- putenv("TZ={$test[0]}");
+ date_default_timezone_set($test[0]);
print "{$test[0]}\n";
array_shift($test);
$timestamp = call_user_func_array('mktime', $test);
Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]")
--FILE--
<?php
- putenv("TZ=GMT");
+ date_default_timezone_set('GMT');
echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT"));
?>
--EXPECT--
Bug #21966 (date() or mktime() returning bad value for mktime month param of '2')
--FILE--
<?php
-putenv("TZ=Europe/London");
+date_default_timezone_set('Europe/London');
echo '27/3/04 = ' . strval(mktime(0,0,0,3,27,2004)) . "\n"; // 1080345600
echo '28/3/04 = ' . strval(mktime(0,0,0,3,28,2004)) . "\n"; // -3662 - should be 108043200
Bug #26090 (allow colons in time zone offset to strtotime())
--FILE--
<?php
-putenv("TZ=America/New_York");
+date_default_timezone_set('America/New_York');
$t = '2003-10-28 10:20:30-0800';
echo date('Y-m-d H:i:s T', strtotime($t)) . "\n";
--TEST--
Bug #26317 (military timezone offset signedness)
---SKIPIF--
-if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
- die("skip unable to change TZ enviroment variable\n");
-}
--FILE--
<?php
- putenv("TZ=GMT0");
+ date_default_timezone_set('GMT0');
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
--TEST--
Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
---SKIPIF--
-if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
- die("skip unable to change TZ enviroment variable\n");
-}
--FILE--
<?php
- putenv("TZ=GMT0");
+ date_default_timezone_set('GMT0');
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
?>
Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT")
--FILE--
<?php
- putenv("TZ=GMT");
+ date_default_timezone_set('GMT');
echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT"));
?>
--EXPECT--
--INI--
error_reporting=2047
--FILE--
-<?php /* $Id$ */
- putenv("TZ=EST"); // No DST
+<?php
+ date_default_timezone_set('EST'); // No DST
$a = mktime(0, 0, 0, 4, 4, 2004, 0);
$b = mktime(0, 0, 0, 4, 4, 2004, 1);
$c = mktime(0, 0, 0, 4, 4, 2004, -1);
echo "$b ".date("m/d/y h:i:s\n",$b);
echo "$c ".date("m/d/y h:i:s\n",$c);
echo "\n";
- putenv("TZ=EST5EDT"); // DST not in effect
+ date_default_timezone_set('EST5EDT'); // DST not in effect
$a = mktime(0, 0, 0, 2, 4, 2004, 0);
$b = mktime(0, 0, 0, 2, 4, 2004, 1);
$c = mktime(0, 0, 0, 2, 4, 2004, -1);
echo "$b ".date("m/d/y h:i:s\n",$b);
echo "$c ".date("m/d/y h:i:s\n",$c);
echo "\n";
- putenv("TZ=EST5EDT"); // Just before DST changeover
+ date_default_timezone_set('EST5EDT'); // Just before DST changeover
$a = mktime(0, 0, 0, 4, 4, 2004, 0);
$b = mktime(0, 0, 0, 4, 4, 2004, 1);
$c = mktime(0, 0, 0, 4, 4, 2004, -1);
echo "$b ".date("m/d/y h:i:s\n",$b);
echo "$c ".date("m/d/y h:i:s\n",$c);
echo "\n";
- putenv("TZ=EST5EDT"); // Just after DST changeover
+ date_default_timezone_set('EST5EDT'); // Just after DST changeover
$a = mktime(3, 0, 0, 4, 4, 2004, 0);
$b = mktime(3, 0, 0, 4, 4, 2004, 1);
$c = mktime(3, 0, 0, 4, 4, 2004, -1);
echo "$b ".date("m/d/y h:i:s\n",$b);
echo "$c ".date("m/d/y h:i:s\n",$c);
echo "\n";
- putenv("TZ=EST5EDT"); // DST in effect
+ date_default_timezone_set('EST5EDT'); // DST in effect
$a = mktime(0, 0, 0, 6, 4, 2004, 0);
$b = mktime(0, 0, 0, 6, 4, 2004, 1);
$c = mktime(0, 0, 0, 6, 4, 2004, -1);
);
foreach ($timezones as $timezone) {
- putenv("TZ=$timezone");
+ date_default_timezone_set($timezone);
echo $timezone, "\n";
foreach ($timestrings as $timestring) {
Bug #28024 (Changed behavior of strtotime())
--FILE--
<?php
- putenv("TZ=Europe/Berlin");
+ date_default_timezone_set('Europe/Berlin');
echo strtotime("17:00 2004-01-01"), "\n";
echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01"));
?>
Bug #28088 (strtotime() cannot convert 00 hours")
--FILE--
<?php
-putenv("TZ=GMT");
+date_default_timezone_set('GMT');
echo "The following line rightly shows the correct date time:\n";
echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n";
Bug #29150 (Roman number format for months)
--FILE--
<?php
- putenv("TZ=GMT");
+ date_default_timezone_set('GMT');
echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005"));
?>
--EXPECT--
Bug #30532 (strtotime - crossing daylight savings time)
--FILE--
<?php
-putenv("TZ=America/New_York");
+date_default_timezone_set('America/New_York');
echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +1 hour'))."\n";
echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +2 hours'))."\n";
echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +3 hours'))."\n";
Bug #32086 (strtotime don't work in DST)
--FILE--
<?php
-putenv("TZ=America/Sao_Paulo");
+date_default_timezone_set('America/Sao_Paulo');
echo $g = strtotime("2004-11-01"), "\n";
echo $i = strtotime("2004-11-01 +1 day"), "\n";
echo $j = strtotime("+1 day", $g), "\n";
Bug #32270 (strtotime/date behavior)
--FILE--
<?php
-putenv("TZ=America/Los_Angeles");
+date_default_timezone_set('America/Los_Angeles');
echo date("m/d/Y H:i:s T", -2145888000)."\n";
Bug #32555 (strtotime("tomorrow") can return false)
--FILE--
<?php
-putenv("TZ=US/Eastern");
+date_default_timezone_set('US/Eastern');
$stamp = 1112427000;
print strftime('%c %Z',strtotime('now',$stamp)) ."\n";
Bug #32588 (strtotime() error for 'last xxx' DST problem)
--FILE--
<?php
-putenv("TZ=America/New_York");
+date_default_timezone_set('America/New_York');
echo date('D Y/m/d/H:i:s', strtotime('last saturday', 1112703348)). "\n";
echo date('D Y/m/d/H:i:s', strtotime("last sunday", 1112703348)). "\n";
<?php
print "TZ=America/Mendoza - wrong day.\n";
-putenv("TZ=America/Mendoza");
+date_default_timezone_set('America/Mendoza');
$tStamp = mktime (17, 17, 17, 1, 8327, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Catamarca - wrong day.\n";
-putenv("TZ=America/Catamarca");
+date_default_timezone_set('America/Catamarca');
$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Cordoba - wrong day.\n";
-putenv("TZ=America/Cordoba");
+date_default_timezone_set('America/Cordoba');
$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Rosario - wrong day.\n";
-putenv("TZ=America/Rosario");
+date_default_timezone_set('America/Rosario');
$tStamp = mktime (17, 17, 17, 1, 7958, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "TZ=Europe/Vienna - wrong day - giving unexpected results, at
least on my system :-)\n";
-putenv("TZ=Europe/Vienna");
+date_default_timezone_set('Europe/Vienna');
$tStamp = mktime (17, 17, 17, 1, 3746, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=Asia/Baku - wrong day.\n";
-putenv("TZ=Asia/Baku");
+date_default_timezone_set('Asia/Baku');
$tStamp = mktime (17, 17, 17, 1, 8299, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Noronha - wrong day.\n";
-putenv("TZ=America/Noronha");
+date_default_timezone_set('America/Noronha');
$tStamp = mktime (17, 17, 17, 1, 10866, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "wanted=Friday 00:00:00\n\n";
print "TZ=America/Havana - wrong day.\n";
-putenv("TZ=America/Havana");
+date_default_timezone_set('America/Havana');
$tStamp = mktime (17, 17, 17, 1, 12720, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=Europe/Tallinn - wrong day.\n";
-putenv("TZ=Europe/Tallinn");
+date_default_timezone_set('Europe/Tallinn');
$tStamp = mktime (17, 17, 17, 1, 11777, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "wanted=Saturday 00:00:00\n\n";
print "TZ=Asia/Jerusalem - wrong day.\n";
-putenv("TZ=Asia/Jerusalem");
+date_default_timezone_set('Asia/Jerusalem');
$tStamp = mktime (17, 17, 17, 1, 13056, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=Europe/Vilnius - wrong day.\n";
-putenv("TZ=Europe/Vilnius");
+date_default_timezone_set('Europe/Vilnius');
$tStamp = mktime (17, 17, 17, 1, 12140, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "wanted=Friday 00:00:00\n\n";
print "TZ=Pacific/Kwajalein - wrong day.\n";
-putenv("TZ=Pacific/Kwajalein");
+date_default_timezone_set('Pacific/Kwajalein');
$tStamp = mktime (17, 17, 17, 1, 8626, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "wanted=Friday 00:00:00\n\n";
print "TZ=Asia/Ulan_Bator - wrong day.\n";
-putenv("TZ=Asia/Ulan_Bator");
+date_default_timezone_set('Asia/Ulan_Bator');
$tStamp = mktime (17, 17, 17, 1, 11588, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "wanted=Saturday 00:00:00\n\n";
print "TZ=America/Cancun - wrong day.\n";
-putenv("TZ=America/Cancun");
+date_default_timezone_set('America/Cancun');
$tStamp = mktime (17, 17, 17, 1, 11785, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Mexico_City - wrong day.\n";
-putenv("TZ=America/Mexico_City");
+date_default_timezone_set('America/Mexico_City');
$tStamp = mktime (17, 17, 17, 1, 11781, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "wanted=Wednesday 00:00:00\n\n";
print "TZ=America/Mazatlan - wrong day.\n";
-putenv("TZ=America/Mazatlan");
+date_default_timezone_set('America/Mazatlan');
$tStamp = mktime (17, 17, 17, 1, 11780, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:00:00\n\n";
print "TZ=America/Chihuahua - wrong day.\n";
-putenv("TZ=America/Chihuahua");
+date_default_timezone_set('America/Chihuahua');
$tStamp = mktime (17, 17, 17, 1, 11782, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=Asia/Kuala_Lumpur - wrong day.\n";
-putenv("TZ=Asia/Kuala_Lumpur");
+date_default_timezone_set('Asia/Kuala_Lumpur');
$tStamp = mktime (17, 17, 17, 1, 4380, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=Pacific/Chatham - wrong day.\n";
-putenv("TZ=Pacific/Chatham");
+date_default_timezone_set('Pacific/Chatham');
$tStamp = mktime (17, 17, 17, 1, 1762, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=America/Lima - wrong day.\n";
-putenv("TZ=America/Lima");
+date_default_timezone_set('America/Lima');
$tStamp = mktime (17, 17, 17, 1, 5839, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=Asia/Karachi - wrong day.\n";
-putenv("TZ=Asia/Karachi");
+date_default_timezone_set('Asia/Karachi');
$tStamp = mktime (17, 17, 17, 1, 11783, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "wanted=Friday 00:00:00\n\n";
print "TZ=America/Asuncion - wrong day.\n";
-putenv("TZ=America/Asuncion");
+date_default_timezone_set('America/Asuncion');
$tStamp = mktime (17, 17, 17, 1, 11746, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "wanted=Wednesday 00:00:00\n\n";
print "TZ=Asia/Singapore - wrong day.\n";
-putenv("TZ=Asia/Singapore");
+date_default_timezone_set('Asia/Singapore');
$tStamp = mktime (17, 17, 17, 1, 4383, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=America/Montevideo - wrong day.\n";
-putenv("TZ=America/Montevideo");
+date_default_timezone_set('America/Montevideo');
$tStamp = mktime (17, 17, 17, 1, 12678, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
--FILE--
<?php
print "TZ=Pacific/Rarotonga - wrong day.\n";
-putenv("TZ=Pacific/Rarotonga");
+date_default_timezone_set('Pacific/Rarotonga');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:00:00\n\n";
print "TZ=Atlantic/South_Georgia - wrong day.\n";
-putenv("TZ=Atlantic/South_Georgia");
+date_default_timezone_set('Atlantic/South_Georgia');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:00:00\n\n";
print "TZ=America/Port-au-Prince - wrong day.\n";
-putenv("TZ=America/Port-au-Prince");
+date_default_timezone_set('America/Port-au-Prince');
$tStamp = mktime (17, 17, 17, 1, 12871, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=Pacific/Enderbury - wrong day, off by 2 days.\n";
-putenv("TZ=Pacific/Enderbury");
+date_default_timezone_set('Pacific/Enderbury');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=Pacific/Kiritimati - wrong day, off by 2 days.\n";
-putenv("TZ=Pacific/Kiritimati");
+date_default_timezone_set('Pacific/Kiritimati');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=America/Managua - wrong day.\n";
-putenv("TZ=America/Managua");
+date_default_timezone_set('America/Managua');
$tStamp = mktime (17, 17, 17, 1, 12879, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:00:00\n\n";
print "TZ=Pacific/Pitcairn - wrong day.\n";
-putenv("TZ=Pacific/Pitcairn");
+date_default_timezone_set('Pacific/Pitcairn');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "wanted=Wednesday 00:00:00\n\n";
print "TZ=Pacific/Fakaofo - wrong day.\n";
-putenv("TZ=Pacific/Fakaofo");
+date_default_timezone_set('Pacific/Fakaofo');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "wanted=Saturday 00:00:00\n\n";
print "TZ=Pacific/Johnston - wrong day.\n";
-putenv("TZ=Pacific/Johnston");
+date_default_timezone_set('Pacific/Johnston');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "TZ=America/Jujuy - Is it OK for this to be 2 AM, rather than 1
AM as per most DST transitions?\n";
-putenv("TZ=America/Jujuy");
+date_default_timezone_set('America/Jujuy');
$tStamp = mktime (17, 17, 17, 1, 7593, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?\n";
-putenv("TZ=Asia/Tbilisi");
+date_default_timezone_set('Asia/Tbilisi');
$tStamp = mktime (17, 17, 17, 1, 12863, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
have a DST or timezone transition.\n";
-putenv("TZ=Africa/Bujumbura");
+date_default_timezone_set('Africa/Bujumbura');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "wanted=Wednesday 00:00:00\n\n";
print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n";
-putenv("TZ=Asia/Thimbu");
+date_default_timezone_set('Asia/Thimbu');
$tStamp = mktime (17, 17, 17, 1, 6476, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
appear to have a DST or timezone transition.\n";
-putenv("TZ=Indian/Cocos");
+date_default_timezone_set('Indian/Cocos');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Africa/Lubumbashi");
+date_default_timezone_set('Africa/Lubumbashi');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "wanted=Saturday 00:00:00\n\n";
print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n";
-putenv("TZ=Asia/Kashgar");
+date_default_timezone_set('Asia/Kashgar');
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Indian/Christmas");
+date_default_timezone_set('Indian/Christmas');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 00:00:00\n\n";
print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n";
-putenv("TZ=America/Santo_Domingo");
+date_default_timezone_set('America/Santo_Domingo');
$tStamp = mktime (17, 17, 17, 1, 291, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not
appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Truk");
+date_default_timezone_set('Pacific/Truk');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Ponape");
+date_default_timezone_set('Pacific/Ponape');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n";
-putenv("TZ=America/Scoresbysund");
+date_default_timezone_set('America/Scoresbysund');
$tStamp = mktime (17, 17, 17, 1, 4099, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "wanted=Sunday 02:00:00\n\n";
print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n";
-putenv("TZ=America/Guyana");
+date_default_timezone_set('America/Guyana');
$tStamp = mktime (17, 17, 17, 1, 2031, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:45:00\n\n";
print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
-putenv("TZ=Asia/Tehran");
+date_default_timezone_set('Asia/Tehran');
$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Tarawa");
+date_default_timezone_set('Pacific/Tarawa');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:00:00\n\n";
print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
-putenv("TZ=Africa/Monrovia");
+date_default_timezone_set('Africa/Monrovia');
$tStamp = mktime (17, 17, 17, 1, 845, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "wanted=Monday 00:44:30\n\n";
print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
-putenv("TZ=Asia/Katmandu");
+date_default_timezone_set('Asia/Katmandu');
$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "wanted=Wednesday 00:15:00\n\n";
print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
-putenv("TZ=Pacific/Nauru");
+date_default_timezone_set('Pacific/Nauru');
$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:30:00\n\n";
print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
-putenv("TZ=Pacific/Niue");
+date_default_timezone_set('Pacific/Niue');
$tStamp = mktime (17, 17, 17, 1, 3189, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
or timezone transition.\n";
-putenv("TZ=Pacific/Port_Moresby");
+date_default_timezone_set('Pacific/Port_Moresby');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "wanted=Thursday 00:00:00\n\n";
print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n";
-putenv("TZ=America/Miquelon");
+date_default_timezone_set('America/Miquelon');
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
timezone transition.\n";
-putenv("TZ=Pacific/Palau");
+date_default_timezone_set('Pacific/Palau');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Funafuti");
+date_default_timezone_set('Pacific/Funafuti');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not
appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Wake");
+date_default_timezone_set('Pacific/Wake');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does
not appear to have a DST or timezone transition.\n";
-putenv("TZ=Pacific/Wallis");
+date_default_timezone_set('Pacific/Wallis');
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "wanted=Tuesday 00:00:00\n\n";
print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
-putenv("TZ=America/Paramaribo");
+date_default_timezone_set('America/Paramaribo');
$tStamp = mktime (17, 17, 17, 1, 5381, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
date.timezone=UTC
--FILE--
<?php
-putenv("TZ=");
+date_default_timezone_set('UTC');
setlocale(LC_ALL, 'C');
print "TZ has NOT been set\n";
print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n";
print "\nSetting TZ\n";
-putenv("TZ=Australia/Sydney");
+date_default_timezone_set('Australia/Sydney');
$input = "10:00:00 AM July 1 2005";
print "input " . $input . "\n";
$tStamp = strtotime($input);
Bug #35425 (idate() function ignores timezone settings)
--FILE--
<?php
-putenv('TZ=America/Montreal');
+date_default_timezone_set('America/Montreal');
$time = mktime(1,1,1,1,1,2005);
foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) {
foreach($timezones as $timezone)
{
- putenv('TZ='.$timezone);
+ date_default_timezone_set($timezone);
/* status of daylight saving time unknown */
var_dump(mktime(0, 0, 0, 1, 1, 2002));
date.timezone=GMT
--FILE--
<?php
- putenv('TZ=Europe/Oslo');
+ date_default_timezone_set('Europe/Oslo');
echo strtotime("2005-06-18 22:15:44"), "\n";
putenv('TZ=Europe/London');
var_dump($var);
?>
--EXPECT--
-string(1) "1"
-string(1) "0"
+unicode(1) "1"
+unicode(1) "0"