1--TEST-- 2strtotime() function 3--SKIPIF-- 4<?php 5if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') { 6 die("skip unable to change TZ environment variable\n"); 7} 8?> 9--FILE-- 10<?php 11 $dates = array ( 12 "1999-10-13", 13 "Oct 13 1999", 14 "2000-01-19", 15 "Jan 19 2000", 16 "2001-12-21", 17 "Dec 21 2001", 18 "2001-12-21 12:16", 19 "Dec 21 2001 12:16", 20 "Dec 21 12:16", 21 "2001-10-22 21:19:58", 22 "2001-10-22 21:19:58-02", 23 "2001-10-22 21:19:58-0213", 24 "2001-10-22 21:19:58+02", 25 "2001-10-22 21:19:58+0213", 26 "2001-10-22T21:20:58-03:40", 27 "2001-10-22T211958-2", 28 "20011022T211958+0213", 29 "20011022T21:20+0215", 30 "1997W011", 31 "2004W101T05:00+0", 32 ); 33 34 echo "*** GMT0\n"; 35 date_default_timezone_set("GMT0"); 36 foreach ($dates as $date) { 37 echo date ("Y-m-d H:i:s\n", strtotime ($date)); 38 } 39 40 echo "*** US/Eastern\n"; 41 date_default_timezone_set("US/Eastern"); 42 if( date("T") == "GMT" ) { 43 // POSIX style 44 date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); 45 } 46 47 foreach ($dates as $date) { 48 echo date ("Y-m-d H:i:s\n", strtotime ($date)); 49 } 50?> 51--EXPECTF-- 52*** GMT0 531999-10-13 00:00:00 541999-10-13 00:00:00 552000-01-19 00:00:00 562000-01-19 00:00:00 572001-12-21 00:00:00 582001-12-21 00:00:00 592001-12-21 12:16:00 602001-12-21 12:16:00 61%d-12-21 12:16:00 622001-10-22 21:19:58 632001-10-22 23:19:58 642001-10-22 23:32:58 652001-10-22 19:19:58 662001-10-22 19:06:58 672001-10-23 01:00:58 682001-10-22 23:19:58 692001-10-22 19:06:58 702001-10-22 19:05:00 711996-12-30 00:00:00 722004-03-01 05:00:00 73*** US/Eastern 741999-10-13 00:00:00 751999-10-13 00:00:00 762000-01-19 00:00:00 772000-01-19 00:00:00 782001-12-21 00:00:00 792001-12-21 00:00:00 802001-12-21 12:16:00 812001-12-21 12:16:00 82%d-12-21 12:16:00 832001-10-22 21:19:58 842001-10-22 19:19:58 852001-10-22 19:32:58 862001-10-22 15:19:58 872001-10-22 15:06:58 882001-10-22 21:00:58 892001-10-22 19:19:58 902001-10-22 15:06:58 912001-10-22 15:05:00 921996-12-30 00:00:00 932004-03-01 00:00:00 94