Annotation of embedaddon/php/ext/date/tests/DateTime_format_basic2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test date_format() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : public string DateTime::format ( string $format )
6: * Description: Returns date formatted according to given format
7: * Source code: ext/date/php_date.c
8: * Alias to functions: date_format
9: */
10:
11: //Set the default time zone
12: date_default_timezone_set("Europe/London");
13:
14: echo "*** Testing date_format() : basic functionality - formatting coinstants ***\n";
15: $date = new DateTime("2005-07-14 22:30:41");
16:
17: var_dump( $date->format( DateTime::ATOM) ) ;
18: var_dump( $date->format( DateTime::COOKIE) ) ;
19: var_dump( $date->format( DateTime::ISO8601) ) ;
20: var_dump( $date->format( DateTime::RFC822) ) ;
21: var_dump( $date->format( DateTime::RFC850) ) ;
22: var_dump( $date->format( DateTime::RFC1036) ) ;
23: var_dump( $date->format( DateTime::RFC1123) ) ;
24: var_dump( $date->format( DateTime:: RFC2822) ) ;
25: var_dump( $date->format( DateTime::RFC3339) ) ;
26: var_dump( $date->format( DateTime::RSS) ) ;
27: var_dump( $date->format( DateTime::W3C) ) ;
28:
29: ?>
30: ===DONE===
31: --EXPECT--
32: *** Testing date_format() : basic functionality - formatting coinstants ***
33: string(25) "2005-07-14T22:30:41+01:00"
34: string(32) "Thursday, 14-Jul-05 22:30:41 BST"
35: string(24) "2005-07-14T22:30:41+0100"
36: string(29) "Thu, 14 Jul 05 22:30:41 +0100"
37: string(32) "Thursday, 14-Jul-05 22:30:41 BST"
38: string(29) "Thu, 14 Jul 05 22:30:41 +0100"
39: string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
40: string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
41: string(25) "2005-07-14T22:30:41+01:00"
42: string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
43: string(25) "2005-07-14T22:30:41+01:00"
44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>