The Ligature Online Manual
Jan 9, 2009

Formatting dates

Use these codes to format the date as you like. If you want to use a plain word (like 'of' or 'the') you must escape each letter of the word with a backslash to keep PHP happy ('\o\f' and '\t\h\e'). For example, to get "Saturday, the 22nd of October, 2005" you would enter
l, \t\h\e jS \o\f F, Y
Year
Y: 2005
y: 05
Month
n: 4 (as one or two digits)
m: 04 (as two digits)
F: April
M: Apr
Day of the year
z: 0-365
Day of the month
S: st/nd/rd/th (two-digit ordinal suffix [e.g. 1st of...])
j: 9 (one or two digits)
d: 09 (two digits)
t: 28-31 (number of days in given month)
Day of the week
l (small L): Monday
D: Mon
w: 0-6 (0 is Sunday)
Hour
g: 7 (12-hour format with one or two digits)
G: 19 (24-hour format with two digits)
h: 07 (12-hour format with one or two digits)
H: 19 (24-hour format with two digits)
Misc time
i: 45 (minutes)
a: am/pm
A: AM/PM
s: 12 (seconds)
U: 1129596111 (seconds since the 1st of January, 1970)
It's always better to show the year as four digits and the month non-numerically because it reduces confusion: lots of people have trouble with an ambiguous date like 06-10-05 because it can be construed as:

Back to top

Ligature and related material is the original property of Desi Quintans, (GPL) 2009.
Documented by txt.page