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 format�no leading zeroes)                                    6
G       Hour (24-hour format�no leading zeroes)                                    18
h       Hour (12-hour format�leading zeroes)                                       06
H       Hour (24-hour format�leading 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 (number�leading zeroes)                                      10
M       Month of year (three letters)                                              Oct
n       Month of year (number�no leading zeroes)                                   10
o       Offset in hours from GMT (in [+-]HHMM format)                              +0100
r       Full date standardized to RFC 822 (   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 (0�366)                                                        280
Z       Offset in seconds from GMT                                                 3600

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.