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”.
The following date and time format codes can be used with any Movable Type tags that output a datetime…
mt:EntryDate tag as an example…
Dec 25, 2009
<$mt:EntryDate format="%b %e, %Y"$>
Dec 25, 2009 11:56 PM
<$mt:EntryDate format="%b %e, %Y %l:%M:%S %p"$>
or the short format….
<$mt:EntryDate format="%x %X"$>
Recognized date and time format codes to be used with the
The language-aware standard date representation. For most languages, this is just the same as %B %d, %Y.
<$mt:EntryDate format="%x"$> will output September 06, 2002
The language-aware time representation. For most languages, this is just the same as %I:%M %p.
<$mt:EntryDate format="%X"$> will output 04:31 PM
The two-digit hour on a 12-hour clock padded with a zero if applicable. (uppercase “i”)
<$mt:EntryDate format="%I"$> will output 04
The hour on a 12-hour clock padded with a space if applicable. (lowercase “L”)
<$mt:EntryDate format="%I"$> will output 4
The two-digit 24-hour clock padded with a zero if applicable. Example: 16.
The two-digit 24-hour clock padded with a space if applicable. Example: 9.
The two-digits minute padded with a leading zero if applicable. Example: 02.
The two-digit second padded with a zero if applicable. Example: 04.
Either AM or PM. Language dependent.
The full weekday name. Example: Thursday.
The abbreviated weekday name. Example: Thu.
The full month name. Example: September.
The abbreviated month name. Example: Sep.
The two-digit month padded with a leading zero if applicable. Example: 09.
The two-digit day of the month padded with leading zeroes if applicable. Example: 09.
The day of the month space padded if applicable. Example: 9.
The four-digit year. Example: 2001.
The two-digit year padded with a leading zero if applicable. Example: 01.
The three-digit day of the year padded with leading zeroes if applicable. Example: 040.
The numeric day of the week ranging from 0 to 6 where 0 is Sunday. Example: 0
language attribute you can get the default language string for different languages.
The default output of
<$mt:Date$> corresponds to the “Date Language” option in the blog’s Entry Settings.
For the English date string
September 3, 2009 2:24 PM, use:
To get the Japanese date string
2009?1′9??? 3?--￥ 14:24, use:
If the ouput is not as desired, use the
format attribute to make a custom string. The following is the same as
<$mt:Date format="%Y?1′%m??? %d?--￥ %H:%M"$>
The following is a list of the recognized language codes:
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.
Note: As of version 2.0 of Movable Type,
%Zis no longer supported. For the timezone see the MTBlogTimezone tag.