Format Codes for Use with date() : date « Date « PHP






Format Codes for Use with date()

 
Format  Description                                                                Example
 
a       am or pm lowercase                                                         pm
 
A       AM or PM uppercase                                                         PM
 
B       Swatch beat (timezone-free 'Internet time')                                771
 
d       Day of month (number with leading zeroes)                                  08
 
D       Day of week (three letters)                                                Wed
 
F       Month name                                                                 October
 
g       Hour (12-hour formatno leading zeroes)                                    6
 
G       Hour (24-hour formatno leading zeroes)                                    18
 
h       Hour (12-hour formatleading zeroes)                                       06
 
H       Hour (24-hour formatleading zeroes)                                       18
 
i       Minutes                                                                    31
 
I       Daylight savings time (Boolean value)                                      1
 
j       Day of the month (no leading zeroes)                                       8
 
l       Day of the week (name)                                                     Wednesday
 
L       Leap year (1 for yes, 0 for no)                                            0
 
m       Month of year (numberleading zeroes)                                      10
 
M       Month of year (three letters)                                              Oct
 
n       Month of year (numberno leading zeroes)                                   10
 
o       Offset in hours from GMT (in [+-]HHMM format)                              +0100
 
r       Full date standardized to RFC 822 (http://www.faqs.org/rfcs/rfc822.html)   Wed, 8 Oct 2003 18:31:15+0100
 
s       Seconds, with leading zeroes                                               15
 
S       English suffix for date in month (e.g. 20th)                               th
 
t       Number of days in the given month                                          31
 
T       Timezone setting on the machine used                                       BST
 
U       Unix timestamp                                                             1065634275
 
w       Day of week (number indexed from Sunday = 0)                               3
 
W       Week of year                                                               41
 
y       Year (two digits)                                                          03
 
Y       Year (four digits)                                                         2003
 
z       Day of year (0366)                                                        280
 
Z       Offset in seconds from GMT                                                 3600
  
  








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.string date ( string date_format [, int timestamp] )
11.Setting Time Zones and GMT/UTC
12.Determining Whether a Given Year Is a Leap Year
13.Formatting a Date 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().