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