Paul Makepeace ;-)

November 4, 2004

Date format in Movable Type

Posted in: Movable Type

MT 2.66's default time format of "04:36 PM" is just wrong, wrong, wrong. Even a crappy digital watch doesn't add a zero to a 12-hour clock. That whole AM/PM thing is kinda last century too (sorry, America).

Fortunately it's easy enough to correct.

* Head to Templates
 * Edit Main Index and search for Date to find MTArchiveDate
 * wherever there's a reference to format="%X" (not "%x"!) or "%I:%M %p" replace it with "%H:%M"
 * Click Save (no rebuild yet)
* Back to Templates
 * Repeat for Category Archive, Date-Based Archive, Individual Entry Archive
 * Repeat for the Individual Entry Archive, Comment Listing Template, and Comment Preview Template looking instead for MTCommentDate: add format="%B %e, %Y %H:%M" to make <$MTCommentDate format="%B %e, %Y %H:%M"$>
 * Repeat last step searching for MTPingDate in the TrackBack Listing Template
 * Click Save each time of course
* Now, Rebuild All

It's a shame there isn't a way (I'm aware of) to set the date format overall rather than a pile of fiddly changes.

The documentation itself is wrong saying "%X" is "The language-aware time representation. For most languages, this is just the same as %I:%M %p. Example: 4:31 PM." but %I is actually the zero-padded 12h format aberration.

Posted by Paul Makepeace at November 4, 2004 09:46 | TrackBack

You can edit mt/lib/MT/ to change the %X and %x defaults for a specific language. Look for your language in %Language (yeah, it's a big file).

Posted by: breun at November 1, 2006 16:57

Very informative and well designed website. I'm sure, you will be successful with it, have a nice day!

Posted by: Longer at May 2, 2007 11:56

More or less not much noteworthy happening today. That's how it is. I haven't been up to anything recently, but what can I say? I guess it doesn't bother me.

Posted by: Voland at May 8, 2007 14:27

Hello admin, nice site! Good luck! Oh yes, one extra comment - make sure the pages are not too long, keep scrolling a minimum.

Posted by: South at May 28, 2007 14:17

Hello, visit my home page: bdsm porn

Posted by: artofey at July 4, 2007 13:08

jGPQnn Hello Perdun! Google.

Posted by: Terbitium at December 13, 2007 06:12
Post a comment

Remember personal info?