Annotation of embedaddon/php/ext/date/tests/002.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: strtotime() function
! 3: --SKIPIF--
! 4: <?php
! 5: if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
! 6: die("skip unable to change TZ enviroment 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
! 53: 1999-10-13 00:00:00
! 54: 1999-10-13 00:00:00
! 55: 2000-01-19 00:00:00
! 56: 2000-01-19 00:00:00
! 57: 2001-12-21 00:00:00
! 58: 2001-12-21 00:00:00
! 59: 2001-12-21 12:16:00
! 60: 2001-12-21 12:16:00
! 61: %d-12-21 12:16:00
! 62: 2001-10-22 21:19:58
! 63: 2001-10-22 23:19:58
! 64: 2001-10-22 23:32:58
! 65: 2001-10-22 19:19:58
! 66: 2001-10-22 19:06:58
! 67: 2001-10-23 01:00:58
! 68: 2001-10-22 23:19:58
! 69: 2001-10-22 19:06:58
! 70: 2001-10-22 19:05:00
! 71: 1996-12-30 00:00:00
! 72: 2004-03-01 05:00:00
! 73: *** US/Eastern
! 74: 1999-10-13 00:00:00
! 75: 1999-10-13 00:00:00
! 76: 2000-01-19 00:00:00
! 77: 2000-01-19 00:00:00
! 78: 2001-12-21 00:00:00
! 79: 2001-12-21 00:00:00
! 80: 2001-12-21 12:16:00
! 81: 2001-12-21 12:16:00
! 82: %d-12-21 12:16:00
! 83: 2001-10-22 21:19:58
! 84: 2001-10-22 19:19:58
! 85: 2001-10-22 19:32:58
! 86: 2001-10-22 15:19:58
! 87: 2001-10-22 15:06:58
! 88: 2001-10-22 21:00:58
! 89: 2001-10-22 19:19:58
! 90: 2001-10-22 15:06:58
! 91: 2001-10-22 15:05:00
! 92: 1996-12-30 00:00:00
! 93: 2004-03-01 00:00:00
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>