xref: /PHP-7.2/ext/date/tests/009.phpt (revision 17ccbeec)
1--TEST--
2strftime() and gmstrftime() tests
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') die('skip posix only test.');
6if (!function_exists('strftime')) die("skip, strftime not available");
7?>
8--FILE--
9<?php
10date_default_timezone_set('Asia/Jerusalem');
11
12$t = mktime(0,0,0, 6, 27, 2006);
13
14var_dump(strftime());
15
16var_dump(strftime(""));
17var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
18var_dump(strftime("%%q %%a", $t));
19var_dump(strftime("%q", $t));
20var_dump(strftime("blah", $t));
21
22var_dump(gmstrftime());
23
24var_dump(gmstrftime(""));
25var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
26var_dump(gmstrftime("%%q %%a", $t));
27var_dump(gmstrftime("%q", $t));
28var_dump(gmstrftime("blah", $t));
29
30echo "Done\n";
31?>
32--EXPECTF--
33Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
34bool(false)
35bool(false)
36string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
37%s %"
38string(5) "%q %a"
39string(%d) "%s"
40string(4) "blah"
41
42Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
43bool(false)
44bool(false)
45string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
46%s %"
47string(5) "%q %a"
48string(%d) "%s"
49string(4) "blah"
50Done
51