strftime

(PHP 3, PHP 4 >= 4.0.0)

strftime --  Format a local time/date according to locale settings

Description

string strftime (string format, int [timestamp])

Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given. Month and weekday names and other language dependent strings respect the current locale set with setlocale().

The following conversion specifiers are recognized in the format string:

Note: Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime().

Example 1. strftime() example

setlocale ("LC_TIME", "C");
print (strftime ("%A in Finnish is "));
setlocale ("LC_TIME", "fi_FI");
print (strftime ("%A, in French "));
setlocale ("LC_TIME", "fr_CA");
print (strftime ("%A and in German "));
setlocale ("LC_TIME", "de_DE");
print (strftime ("%A.\n"));
This example works if you have the respective locales installed in your system.

See also setlocale() and mktime() and the Open Group specification of strftime().



Banner.Novgorod.Ru