1--TEST-- 2Date constants 3--FILE-- 4<?php 5 date_default_timezone_set("Europe/Oslo"); 6 $constants = array( 7 DATE_ATOM, 8 DATE_COOKIE, 9 DATE_ISO8601, 10 DATE_RFC822, 11 DATE_RFC850, 12 DATE_RFC1036, 13 DATE_RFC1123, 14 DATE_RFC2822, 15 DATE_RFC3339, 16 DATE_RSS, 17 DATE_W3C 18 ); 19 20 foreach($constants as $const) { 21 var_dump(date($const, strtotime("1 Jul 06 14:27:30 +0200"))); 22 var_dump(date($const, strtotime("2006-05-30T14:32:13+02:00"))); 23 } 24 25 print "\n"; 26 27 var_dump( 28 DATE_ATOM == DateTime::ATOM, 29 DATE_COOKIE == DateTime::COOKIE, 30 DATE_ISO8601 == DateTime::ISO8601, 31 DATE_RFC822 == DateTime::RFC822, 32 DATE_RFC850 == DateTime::RFC850, 33 DATE_RFC1036 == DateTime::RFC1036, 34 DATE_RFC1123 == DateTime::RFC1123, 35 DATE_RFC2822 == DateTime::RFC2822, 36 DATE_RFC3339 == DateTime::RFC3339, 37 DATE_RSS == DateTime::RSS, 38 DATE_W3C == DateTime::W3C 39 ); 40?> 41--EXPECT-- 42string(25) "2006-07-01T14:27:30+02:00" 43string(25) "2006-05-30T14:32:13+02:00" 44string(35) "Saturday, 01-Jul-2006 14:27:30 CEST" 45string(34) "Tuesday, 30-May-2006 14:32:13 CEST" 46string(24) "2006-07-01T14:27:30+0200" 47string(24) "2006-05-30T14:32:13+0200" 48string(29) "Sat, 01 Jul 06 14:27:30 +0200" 49string(29) "Tue, 30 May 06 14:32:13 +0200" 50string(33) "Saturday, 01-Jul-06 14:27:30 CEST" 51string(32) "Tuesday, 30-May-06 14:32:13 CEST" 52string(29) "Sat, 01 Jul 06 14:27:30 +0200" 53string(29) "Tue, 30 May 06 14:32:13 +0200" 54string(31) "Sat, 01 Jul 2006 14:27:30 +0200" 55string(31) "Tue, 30 May 2006 14:32:13 +0200" 56string(31) "Sat, 01 Jul 2006 14:27:30 +0200" 57string(31) "Tue, 30 May 2006 14:32:13 +0200" 58string(25) "2006-07-01T14:27:30+02:00" 59string(25) "2006-05-30T14:32:13+02:00" 60string(31) "Sat, 01 Jul 2006 14:27:30 +0200" 61string(31) "Tue, 30 May 2006 14:32:13 +0200" 62string(25) "2006-07-01T14:27:30+02:00" 63string(25) "2006-05-30T14:32:13+02:00" 64 65bool(true) 66bool(true) 67bool(true) 68bool(true) 69bool(true) 70bool(true) 71bool(true) 72bool(true) 73bool(true) 74bool(true) 75bool(true) 76