Resources > PHP Date Format

The following chart provides you with characters to modify the format of date displayed in a PHP document. Please note that capitalizing a latter makes a difference. Pay attention to CAPSLOCK if you have it turned on. Last updated on August 15 2008

Tutorials: Insert Current Date | Last Modified Date

Format Characters
a = am or pm
A = AM or PM
d = day in numbers (01 to 31)
j = Day in numbers (1 to 31)
D = day in abbreviations (Mon, Tue, ...)
l = Day (Monday, Tuesday, ...) (this is a lowercase L)
F = Month (January, February, ...)
M = Month in abbreviations (Jan, Feb, ...)
m = Month (01 to 12)
n = Month (1 to 12)
g = Hour (1 to 12)
G = Hour (1 to 24)
h = Hour (01 to 12)
H = Hour (01 to 24)
i = Minutes (00 to 59)
s = Seconds (00 to 59)
y = Year (2 digits) (e.g. 06, 07, etc.)
Y = Year (4 digits) (e.g. 2006, 2007, etc.)
S = Suffix (st, nd, rd, ...) (e.g. 1st)
t = Number of days in current month (28, 29, 30, 31)
w = Day of the week (0 for sunday to 6 for saturday)
z = Day of year (0 to 365/364)

Layout © Sarah | Resources: 1 2 | Powered by Wordpress