I find myself referring to the Movable Type user manual a lot, especially the page on date formats. However — much like the rest of the user manual — this page is not very user-friendly.
So, I thought I’d create my own quick reference guide to date formats in order to present this information in a more accessible way.
| Output | Code | Description |
|---|---|---|
| 2006 | %Y | The four-digit year |
| 06 | %y | The two-digit year padded with a leading zero if applicable |
| September | %B | The full month name |
| Sep | %b | The abbreviated month name |
| 09 | %m | The two-digit month padded with a leading zero if applicable |
| Thursday | %A | The full weekday name |
| Thu | %a | The abbreviated weekday name |
| 09 | %d | The two-digit day of the month padded with leading zeroes if applicable |
| 9 | %e | The day of the month space padded if applicable |
| September 06, 2006 | %x | The language-aware standard date representation. For most languages, this is just the same as %B %d, %Y |
| 04 | %I | The two-digit hour on a 12-hour clock padded with a zero if applicable |
| 4 | %l | The hour on a 12-hour clock padded with a space if applicable |
| 16 | %H | The two-digit military time hour padded with a zero if applicable |
| 8 | %k | The two-digit military time hour padded with a space if applicable |
| 02 | %M | The two-digits minute padded with a leading zero if applicable |
| 04 | %S | The two-digit second padded with a zero if applicable |
| AM | %p | Either AM or PM. Language dependent |
| 04:31 PM | %X | The language-aware time representation. For most languages, this is just the same as %I:%M %p |
| 2 | %w | The numeric day of the week ranging from 0 to 6 where 0 is Sunday |
| 040 | %j | The three-digit day of the year padded with leading zeroes if applicable |
Example Usage
| Output | Code |
|---|---|
| July 4, 2006 | |
| 4 Jul ’06 | |
| 07/04/06 | |
| Monday, July 4 | |
| Posted at 9:15 AM on July 4, 2006 | Posted at on |