MT 的日期格式

Date Tag Formats
Movable Type uses standard strftime format strings to describe dates and times. (However, note that strftime itself is not actually used to perform the formatting.) In any date tag, you should use the format attribute to specify the format string, like this:

<$MTDate format="%B %e, %Y %I:%M %p"$>
The above format is actually the default format for English date formatting, and creates a date looking like this:

September 20, 2001 11:44 PM

The language used in weekday names, month names, and AM/PM specifiers can be chosen in the Weblog Configuration as Language for date display. The default language used is English.

You can override the default language setting by using the language attribute to specify the language; this will apply only for the particular date string that you are formatting. Here is the list of available language tags: cz, dk, nl, en, fr, de, is, jp, it, no, pl, pt, si, es, fi, se.

So, to make the same English date formatting (Month Day, Year Hour:Minute AM/PM) in french, the code would be:


<$MTDate format="%B %e, %Y %I:%M %p" language="fr"$>
Here is a list of the format specifiers:


%a - The abbreviated weekday name. Example: Thu.
%A - The full weekday name. Example: Thursday.
%b - The abbreviated month name. Example: Sep.
%B - The full month name. Example: September.
%d - The day of the month, two digits, padded with a 0 if necessary. Example: 09.
%e - The day of the month, padded with a space if necessary. Example: 9.
%H - The hour, using a 24-hour clock (military time), two digits, padded with a 0 if necessary. Example: 16.
%I - The hour, using a 12-hour clock, two digits, padded with a 0 if necessary. Example: 04.
%j - The day of the year, three digits, padded with 0s if necessary. Example: 056.
%k - The hour, using a 24-hour clock (military time), two digits, padded with a space if necessary. Example: 9.
%l - The hour, using a 12-hour clock, two digits, padded with a space if necessary. Example: 4.
%m - The month, two digits, padded with a 0 if necessary. Example: 09.
%M - The minute, two digits, padded with a 0 if necessary. Example: 02.
%p - Either AM or PM.
%S - The second, two digits, padded with a 0 if necessary. Example: 04.
%x - The language-aware date representation. For most languages, this is just the same as %B %e, %Y. Example: September 6, 2002.
%X - The language-aware time representation. For most languages, this is just the same as %I:%M %p. Example: 4:31 PM.
%y - The year, two digits, padded with a 0 if necessary. Example: 01.
%Y - The year, four digits. Example: 2001.

1 Comment

Hello! Good Site! Thanks you! ejguugsgihm

Leave a comment

Recent Entries

  • How to remove a VMHost from SCVMM 2008 R2 forcefully

    这几天碰到个问题,有个服务器原来安装的是 2008 Server Core系统,上面跑 Hyper-V,已经将其导入 SCVMM 2008 R2 来管理。最近实在是嫌 Server Core 管理太不方便,于是想把系统换成带图形界面的,也没在 SCVMM 里面把主机删除,直接就重装了,IP和计算机名什么的都没变,结果问题来了,再打开 SCVMM 的控制台,发现这台主机联系不上(当然,因为重装的没有了 Agent),就想删掉再重加,结果删除过程报错:Error (801) VMM cannot find ISO object . Recommended...

  • Outlook Mobile Update

    现在你可通过新的Microsoft Office Outlook Mobile更新程序和 Microsoft Exchange Server 2010 来保证你手上的信息是最有价值的。 这次的 Outlook Mobile 更新仅针对 Windows Mobile 6.1 的手机。 当你的手机连接到 Exchange Server 2010 时,如果有适合的更新你会收到自动的提示。 如果你的手机的系统是 Windows Mobile...

  • 哥们,我的更新汇总在哪呢?

    我刚刚在我全新的 Exchange 2010 服务器上安装了更新汇总1 - RU1, 然后运行 Get-Exchangeserver -Identity MyExchangeServer (译者: 可以用 Get-Exchangeserver -Identity MyExchangeServer | fl ExchangeVersion, AdminDisplayVersion)得到以下关于AdminsDisplayVersion 和 ExchangeVersion 的版本信息: 嗯, 这看上去有点眼熟(译者:...

  • Exchange 2010 Update Rollup 2

    Today Microsoft released Update Rollup 2 for Microsoft Exchange Server 2010. RU2 comes 3 months after the release of RU1. The list of included fixes...

  • HMC 4.0 Update Rollup 3 has been updated

    Description of Update Rollup 3 for Hosted Messaging and Collaboration 4.0http://support.microsoft.com/kb/979702/en-usMicrosoft released an update rollup that is dated December 2009. This update fixes issues that...

Close