Not a developer? Go to MovableType.com

Documentation

Date

Outputs the current date.

Attributes

  • ts (optional): If specified, will use the given date as the date to publish. Must be in the format of “YYYYMMDDhhmmss”.

  • relative (optional): If specified, will publish the date using a phrase, if the date is less than a week from the current date. Accepted values are “1”, “2”, “3” and “js”. The options for “1”, “2” and “3” affect the style of the phrase. Note that static content must be republished to see the date stamp updated.

    • relative="1": Supports display of one duration: moments ago; N minutes ago; N hours ago; N days ago. For older dates in the same year, the date is shown as the abbreviated month and day of the month (“Jan 3”). For older dates, the year is added to that (“Jan 3 2005”).
    • relative="2": Supports display of up to two durations: less than 1 minute ago; N seconds, N minutes ago; N minutes ago; N hours, N minutes ago; N hours ago; N days, N hours ago; N days ago.
    • relative="3": Supports display of two durations: N seconds ago; N seconds, N minutes ago; N minutes ago; N hours, N minutes ago; N hours ago; N days, N hours ago; N days ago.
    • relative="js": When specified, publishes the current date and relies on an MT JavaScript function mtRelativeDate to format the date.
  • format (optional): A string that provides the format in which to publish the date. If unspecified, the default that is appropriate for the language of the blog is used (for English, this is “%B %e, %Y %l:%M %p”). Refer to the Date Format documentation for all possible values and examples of their use.

  • format_name (optional): Supports date formatting for particular standards.

    • rfc822: Outputs the date in the format: “%a, %d %b %Y %H:%M:%S Z”.
    • iso8601: Outputs the date in the format: “%Y-%m-%dT%H:%M:%SZ”.
  • utc (optional): Converts the date into UTC time.

  • offset_blog_id (optional): Identifies the ID of the blog to use for adjusting the time to blog time. Will default to the current blog in context if unset.

  • language (optional): Used to force localization of the date to a specific language. Accepted values: “cz” (Czechoslovakian), “dk” (Scandinavian), “nl” (Dutch), “en” (English), “fr” (French), “de” (German), “is” (Icelandic), “ja” (Japanese), “it” (Italian), “no” (Norwegian), “pl” (Polish), “pt” (Portuguese), “si” (Slovenian), “es” (Spanish), “fi” (Finnish), “se” (Swedish). Will use the blog’s date language setting as a default.

Examples

Format YYYY-MM-DD (2009-05-22, for example)

<mt:Date format="%Y-%m-%d">

Format Day of Week, Month DD, YYYY (Friday, May 22, 2009)

<mt:Date format="%A, %b %e, %Y">

This tag is particularly useful to output a date stamp for a copyright notice. If this notice is included on a Template Module (perhaps a “footer”) using a Server Side Include option (such as PHP) the date will remain correct and update any time content is published.

Copyright 2007-<mt:Date format="%Y">, all rights reserved.

More examples:

<mt:Date utc=1>

<mt:Date relative="js">

<mt:Date format_name="rfc822">

Combinations:

<mt:Date utc=1 relative="js" format_name="rfc822">
Back

1 Comment

wgeorge

wgeorge on June 16, 2010, 1:41 p.m. Reply

More examples:

<mt:date utc=1>

<mt:date relative=”js”>

<mt:date format_name=”rfc822”>

Combinations:

<mt:date utc=1 relative=”js” format_name=”rfc822”>

Leave a Comment