xref: /PHP-5.3/ext/date/tests/date_basic1.phpt (revision a2e47734)
1--TEST--
2Test date() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : string date  ( string $format  [, int $timestamp  ] )
6 * Description: Format a local time/date.
7 * Source code: ext/date/php_date.c
8 */
9
10//Set the default time zone
11date_default_timezone_set("Europe/London");
12
13echo "*** Testing date() : basic functionality ***\n";
14
15$timestamp = mktime(10, 44, 30, 2, 27, 2009);
16
17var_dump( date("F j, Y, g:i a", $timestamp) );
18var_dump( date("m.d.y", $timestamp) );
19var_dump( date("j, n, Y", $timestamp) );
20var_dump( date("Ymd", $timestamp) );
21var_dump( date('h-i-s, j-m-y, it is w Day', $timestamp) );
22var_dump( date('\i\t \i\s \t\h\e jS \d\a\y.', $timestamp) );
23var_dump( date("D M j G:i:s T Y", $timestamp) );
24var_dump( date('H:m:s \m \i\s\ \m\o\n\t\h', $timestamp) );
25var_dump( date("H:i:s", $timestamp) );
26
27?>
28===DONE===
29--EXPECT--
30*** Testing date() : basic functionality ***
31string(27) "February 27, 2009, 10:44 am"
32string(8) "02.27.09"
33string(11) "27, 2, 2009"
34string(8) "20090227"
35string(39) "10-44-30, 27-02-09, 4428 4430 5 Friam09"
36string(19) "it is the 27th day."
37string(28) "Fri Feb 27 10:44:30 GMT 2009"
38string(19) "10:02:30 m is month"
39string(8) "10:44:30"
40===DONE===
41
42