xref: /PHP-7.3/ext/date/tests/strftime_basic.phpt (revision 782352c5)
1--TEST--
2Test strftime() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : string strftime(string format [, int timestamp])
6 * Description: Format a local time/date according to locale settings
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10
11echo "*** Testing strftime() : basic functionality ***\n";
12
13date_default_timezone_set("Asia/Calcutta");
14// Initialise all required variables
15$format = '%b %d %Y %H:%M:%S';
16$timestamp = mktime(8, 8, 8, 8, 8, 2008);
17
18// Calling strftime() with all possible arguments
19var_dump( strftime($format, $timestamp) );
20
21// Calling strftime() with mandatory arguments
22var_dump( strftime($format) );
23
24?>
25===DONE===
26--EXPECTF--
27*** Testing strftime() : basic functionality ***
28string(20) "Aug 08 2008 08:08:08"
29string(%d) "%s %d %d %d:%d:%d"
30===DONE===
31