string date ( string date_format [, int timestamp] ) : date « Date « PHP






string date ( string date_format [, int timestamp] )

 
Format characters for use in date( )

Format character     Description                       Example
 
a                    Lowercase am/pm                   am or pm
 
A                    Uppercase am/pm                   AM or PM
 
B                    Swatch Internet Time              000 to 999
 
c                    ISO 8601 date, time, and time zone       2004-06-18T09:26:55+01:00
 
d                    2-digit day of month, leading zeros      01 to 31
 
D                    Day string, three letters                Mon, Thu, Sat
 
F                    Month string, full                       January, August
 
g                    12-hour clock hour, no leading zeros     1 to 12
 
G                    24-hour clock hour, no leading zeros     0 to 23
 
h                    12-hour clock hour, leading zeros        01 to 12
 
H                    24-hour clock hour, leading zeros        00 to 23
 
i                    Minutes with leading zeros               00 to 59
 
I                    Is daylight savings time active?         1 if yes, 0 if no
 
j                    Day of month, no leading zeros           1 to 31
 
l                    Day string, full                         Monday, Saturday
 
L                    Is it a leap year?                       1 if yes, 0 if no
 
m                    Numeric month, leading zeros             01 to 12
 
M                    Short month string                       Jan, Aug
 
n                    Numeric month, no leading zeros          1 to 12
 
O                    Difference from GMT                      200
 
r                    RFC-822 formatted date                   Sat, 22 Dec 1979 17:30 +0000
 
s                    Seconds, with leading zeros              00 to 59
 
S                    English ordinal suffix for day number    st, nd, rd, or th
 
t                    Number of days in month                  28 to 31
 
T                    Time zone for server                     GMT, CET, EST
 
U                    Unix Timestamp                           1056150334
 
w                    Numeric day of week                      0 (Sunday), 6 (Saturday)
 
W                    ISO-8601 week number of year             30 (30th week of the year)
 
y                    Two-digit representation of year         97, 02
 
Y                    Four-digit representation of year        1997, 2002
 
z                    Day of year                              0 to 366
 
Z                    Time zone offset in seconds              -43200 to 43200
  
  








Related examples in the same category

1.Converting Human-Readable Dates Into Unix Timestamps Using strtotime()
2.Formatting Characters for the date() Function for Complete Date and Time
3.Formatting Characters for the date() Function for Day
4.Formatting Characters for the date() Function for Hour
5.Formatting Characters for the date() Function for Minute
6.Formatting Characters for the date() Function for Month
7.Formatting Characters for the date() Function for Second
8.Formatting Characters for the date() Function for Year
9.Parsing a date with substr()
10.Setting Time Zones and GMT/UTC
11.Determining Whether a Given Year Is a Leap Year
12.Formatting a Date with date()
13.Format Codes for Use with date()
14.Format date in an array
15.Displaying Human-Readable Dates and Times
16.Get different part of a date
17.Get file name, size, last access time and modified time
18.Greetings based on time
19.Making the date and time appear like we expect
20.Offsets from UTC
21.Outputs the date in the format of 31st of August 2005
22.number days any month
23.number days current month
24.calculate number days from date
25.Using various formatting strings with date().