xref: /PHP-7.4/ext/date/tests/009.phpt (revision 3a857852)
1--TEST--
2strftime() and gmstrftime() tests
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') die('skip posix only test.');
6?>
7--FILE--
8<?php
9date_default_timezone_set('Asia/Jerusalem');
10
11$t = mktime(0,0,0, 6, 27, 2006);
12
13var_dump(strftime());
14
15var_dump(strftime(""));
16var_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));
17var_dump(strftime("%%q %%a", $t));
18var_dump(strftime("%q", $t));
19var_dump(strftime("blah", $t));
20
21var_dump(gmstrftime());
22
23var_dump(gmstrftime(""));
24var_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));
25var_dump(gmstrftime("%%q %%a", $t));
26var_dump(gmstrftime("%q", $t));
27var_dump(gmstrftime("blah", $t));
28
29echo "Done\n";
30?>
31--EXPECTF--
32Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
33bool(false)
34bool(false)
35string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
36%s %"
37string(5) "%q %a"
38string(%d) "%s"
39string(4) "blah"
40
41Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
42bool(false)
43bool(false)
44string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
45%s %"
46string(5) "%q %a"
47string(%d) "%s"
48string(4) "blah"
49Done
50