strftime --
Format a local time/date according to locale settings
Syntax
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:
%a - abbreviated weekday name according to the current locale
%A - full weekday name according to the current locale
%b - abbreviated month name according to the current locale
%B - full month name according to the current locale
%c - preferred date and time representation for the current
locale
%C - century number (the year divided by 100 and truncated to
an integer, range 00 to 99)
%d - day of the month as a decimal number (range 01 to 31)
%D - same as %m/%d/%y
%e - day of the month as a decimal number, a single digit is
preceded by a space (range ' 1' to '31')
%g - like %G, but without the century.
%G - The 4-digit year corresponding to the ISO week number (see %V).
This has the same format and value as %Y, except that if the ISO week
number belongs to the previous or next year, that year is used
instead.
%h - same as %b
%H - hour as a decimal number using a 24-hour clock (range 00
to 23)
%I - hour as a decimal number using a 12-hour clock (range 01
to 12)
%j - day of the year as a decimal number (range 001 to 366)
%m - month as a decimal number (range 01 to 12)
%M - minute as a decimal number
%n - newline character
%p - either `am' or `pm' according to the given time value, or
the corresponding strings for the current locale
%r - time in a.m. and p.m. notation
%R - time in 24 hour notation
%S - second as a decimal number
%t - tab character
%T - current time, equal to %H:%M:%S
%u - weekday as a decimal number [1,7], with 1 representing
Monday
Warning
Sun Solaris seems to start with Sunday as 1
although ISO 9889:1999 (the current C standard) clearly
specifies that it should be Monday.
%U - week number of the current year as a decimal number,
starting with the first Sunday as the first day of the first
week
%V - The ISO 8601:1988 week number of the current year as a
decimal number, range 01 to 53, where week 1 is the first
week that has at least 4 days in the current year, and with
Monday as the first day of the week. (Use %G or %g for the year
component that corresponds to the week number for the specified
timestamp.)
%W - week number of the current year as a decimal number,
starting with the first Monday as the first day of the first
week
%w - day of the week as a decimal, Sunday being 0
%x - preferred date representation for the current locale
without the time
%X - preferred time representation for the current locale
without the date
%y - year as a decimal number without a century (range 00 to
99)
%Y - year as a decimal number including the century
%Z or %z - time zone or name or abbreviation
%% - a literal `%' character
Note:
Not all conversion specifiers may be supported by your C
library, in which case they will not be supported by PHP's
strftime(). Additionally, not all platforms
support negative timestamps, therefore your date range may
be limited to no earlier than the Unix epoch. This means that
e.g. %e, %T, %R and %D (there might be more) and dates prior to
Jan 1, 1970 will not work on Windows, some Linux
distributions, and a few other operating systems. For Windows systems a
complete overview of supported conversion specifiers can be found at this
MSDN website.
Example 1. strftime() locale examples
<?php setlocale(LC_TIME, "C"); echo strftime("%A"); setlocale(LC_TIME, "fi_FI"); echo strftime(" in Finnish is %A,"); setlocale(LC_TIME, "fr_FR"); echo strftime(" in French %A and"); setlocale(LC_TIME, "de_DE"); echo strftime(" in German %A.\n"); ?>
This example works if you have the respective locales installed
in your system.
Note:
%G and %V, which are based on ISO 8601:1988 week numbers can
give unexpected (albeit correct) results if the numbering system
is not thoroughly understood. See %V above and example below.
Example 2. ISO 8601:1988 week number example
<?php /* December 2002 / January 2003 ISOWk M Tu W Thu F Sa Su ----- ---------------------------- 51 16 17 18 19 20 21 22 52 23 24 25 26 27 28 29 1 30 31 1 2 3 4 5 2 6 7 8 9 10 11 12 3 13 14 15 16 17 18 19 */
strftime php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php strftime syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.