Movable Type Documentation > Appendices

Date Formats

Movable Type lets you specify the exact formatting of dates and times that are displayed anywhere on your site. The system uses a simple code to represent the part of the time or date, as well as the specific display you've chosen. The default option, for example, is %x, which outputs date in the normal format for your region.

In US English, that represents %B %d, %Y, where %B is a full name of a month, like "September", %d is the two-digit day of the month, with a leading "0" if needed, like "06", and %Y is the four-digit year, like "2007".

Date and Time Codes

The following are the recognized date and time format codes:

General

  • %x The language-aware standard date representation. For most languages, this is just the same as %B %d, %Y. Example: September 06, 2002.

  • %X The language-aware time representation. For most languages, this is just the same as %I:%M %p. Example: 04:31 PM.

Time

  • %I The two-digit hour on a 12-hour clock padded with a zero if applicable. Example: 04.
  • %l The hour on a 12-hour clock padded with a space if applicable. Example: 4.
  • %H The two-digit military time hour padded with a zero if applicable. Example: 16.
  • %k The two-digit military time hour padded with a space if applicable. Example: 9.

  • %M The two-digits minute padded with a leading zero if applicable. Example: 02.

  • %S The two-digit second padded with a zero if applicable. Example: 04.

  • %p Either AM or PM. Language dependent.

Dates

  • %A The full weekday name. Example: Thursday.
  • %a The abbreviated weekday name. Example: Thu.

  • %B The full month name. Example: September.

  • %b The abbreviated month name. Example: Sep.
  • %m The two-digit month padded with a leading zero if applicable. Example: 09.

  • %d The two-digit day of the month padded with leading zeroes if applicable. Example: 09.

  • %e The day of the month space padded if applicable. Example: 9.

  • %Y The four-digit year. Example: 2001.

  • %y The two-digit year padded with a leading zero if applicable. Example: 01.

  • %j The three-digit day of the year padded with leading zeroes if applicable. Example: 040.

  • %w The numeric day of the week ranging from 0 to 6 where 0 is Sunday. Example: 0

Language Codes

The following is a list of the recognized language codes:

  • cz - Czechoslovakian
  • dk - Scandinavian
  • nl - Dutch
  • en - English
  • fr - French
  • de - German
  • is - Icelandic
  • jp - Japanese
  • it - Italian
  • no - Norwegian
  • pl - Polish
  • pt - Portuguese
  • si - Slovenian
  • es - Spanish
  • fi - Finnish
  • se - Swedish

Technical details

All date and time tags inherit the two attributes that control their presentation.

Movable Type uses standard strftime format strings to describe date and time layouts using the format attribute. Furthermore, the language attribute can be used to override the weblog's preferred language setting in weekday names, month names, and AM/PM codes. This override will apply only for the particular date string that you are formatting.

As of version 2.0 of Movable Type, %Z is no longer supported. For the timezone see the MTBlogTimezone tag.

This page was last updated on 2007-08-07, 00:26.  

Submit a User Contributed Note

User contributed notes are a great way to share the knowledge you have gained in using Movable Type.

If you have a technical question or problem, please visit Movable Type Support.

(If you haven't left a note here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)