
Reorganized Date Formatting Options
I posted a Feature Request for this to be changed in the EE Docs, but I know the EE folks are busy so I’m posting a version of the EE date formatting options, reorganized by output rather than alphabetically by letter.
Seconds:
- %s - seconds (“00” to “59”)
- %U - seconds since the epoch
Minutes:
- %i - minutes (“00” to “59”)
Hours:
- %g - hour, 12-hour format without leading zeros (“1” to “12”)
- %G - hour, 24-hour format without leading zeros (“0” to “23”)
- %h - hour, 12-hour format (“01” to “12”)
- %H - hour, 24-hour format (“00” to “23”)
AM/PM:
- %a - “am” or “pm”
- %A - “AM” or “PM”
Day:
- %d - day of the month, 2 digits with leading zeros (“01” to “31”)
- %D - day of the week, textual, 3 letters (“Fri”)
- %j - day of the month without leading zeros (“1” to “31”)
- %l (lowercase ‘L’) - day of the week, textual, long (“Friday”)
- %w - day of the week, numeric - “0” (Sunday) to “6” (Saturday)
- %z - day of the year (“0” to “365”)
- %S - English ordinal suffix, 2 characters; (“th”, “nd”)
Week:
- %W - ISO-8601 week number of year, weeks starting on Monday (“42”: the 42nd week in the year)
Month:
- %M - month, textual, 3 letters (“Jan”)
- %F - month, textual, long (“January”)
- %n - month without leading zeros (“1” to “12”)
- %m - month with leading zeros (“01” to “12”)
- %t - number of days in the given month (“28” to “31”)
Year:
- %y - year, 2 digits (“99”)
- %Y - year, 4 digits (“1999”)
- %L - boolean for whether it is a leap year (“0” or “1”)
Other
- %B - Swatch Internet time
- %I (capital i) - “1” if Daylight Saving Time, “0” otherwise.
- %T - Time zone setting of this machine (“MDT”)
- %Z - time zone offset in seconds (”-43200” to “43200”). The offset for time zones west of UTC is always negative, and for those east of UTC is always positive.
- %Q - local server time zone offset, in hours and seconds, against GMT (e.g. “+06:00”)
- %r - RFC 822 formatting (“Thu, 21 Dec 2000 16:01:07 +0200”)
Common Formats
12/12/09
{entry_date format="%m/%d/%y"}
January 10, 2010
{entry_date format="%F %j, %Y"}
Wednesday, July 16th, 2008
{entry_date format="%l, %F %j%S, %Y"}
01/11 at 01:31 PM
{entry_date format='%m/%d'} at {entry_date format='%h:%i %A'}
Category Navigation
by Jesse Schutt
Date: Monday, January 11th, 2010
Comment: #1
Hey Mike,
You could really sweeten up this page if you compiled a bunch of the regulars like 1/11/10 or January 1, 2010 in the date formats. Or I could do it and quit being lazy!