WordPress Date & Time Display

Posted on Monday, August 10th, 2009 at 4:31 pm in

WordPress uses the_date() and the_time() template tags to display the posting dates and times. The letters within the brackets (such 'F j, Y') are used to define exactly what format is used to display these timestamps.

Some of the most common codes are shown below:

Parameter Description Example
Day
d 2 digits with leading zeros 01
D Shortened version of weekday name Mon
j Digits without leading zeros 1
l (lowercase 'L') Full weekday name Saturday
N Day numbers 1 (Monday) to 7 (Sunday)
S Day suffix st, nd, rd or th
w Day numbers 0 (Sunday) to 6 (Saturday)
z Day of the year (starting from 0) 0 – 365
Week
W Week number 42 (the 42nd week in the year)
Month
F Full month name January
m Month number with leading zeros 01 through 12
M Shortened month name Jan
n Month number without leading zeros 1
Year
Y 4 digit year 2009
y A two digit year 09
Time
a Lowercase am or pm am
A Uppercase am or pm AM
g Hour in 12-hour format without leading zeros 1 – 12
G Hour in 24-hour format without leading zeros 0 – 23
h Hour in 12-hour format with leading zeros 01 – 12
H Hour in 24-hour format with leading zeros 00 – 23
i Minutes with leading zeros 00 – 59
s Seconds with leading zeros 00 – 59
Timezone
e Timezone identifier UTC, GMT
T Timezone abbreviation EST, MDT
You might also be interested in

WordPress Support Services

Top