MTRelativeDate

I saw some php code for this, so I thought I'd take it one step further and make this into a plugin.

Here's an example of how you can use it:

<MTEntries lastn="15">
<MTDateHeader>
<br />
<MTEntryRelativeDate format="%x"><br />
</MTDateHeader>

<$MTEntryTitle$><br />
</MTEntries>
</codesnip>
Download relativedate.tar.gz or relativedate.zip, unpack it, and place it in your plugins directory.

<MTEntryRelativeDate>, <MTCommentRelativeDate>, <MTCommentPreviewRelativeDate>, <MTArchiveRelativeDate>, <MTCalendarRelativeDate>, and <MTPingRelativeDate>

  • They all act exactly as their non-relative versions do, taking the same arguments (format and language)
  • They will return "Today" or "Yesterday" when appropriate for the blog's timezone (i.e. any time after midnight this morning is Today, anytime between then and midnight the previous night is Yesterday)
  • Arguments:
    • include_date: include the date in the Today and Yesterday outputs (e.g <MTRelativeDate format="%x" include_date="1">)
    • glue: text to put between Today/Yesterday and the date, defaults to ", "

ChangeLog:

Version 0.15: Added include_date and glue

Version 0.1: First version

6 TrackBacks

David Raynes: MTRelativeDate (v0.1) MTForums thread Read More

Just thought I would let all you :mt: users know of a couple of cool new hacks by David Rayners Read More

Cool new plug in from no assembly required on January 20, 2003 9:09 PM

I just got the relative date plug-in to work. Look at the top of the posts, it sais "Today" not Read More

Cool new plug in from no assembly required on January 20, 2003 9:25 PM

I just got the relative date plug-in to work. Look at the top of the posts, it sais "Today" not Read More

Moveable Type Dork-Out from Tandoku.com by Tom Harpel on November 3, 2003 2:05 AM

Tweaking the Moveable Type implementation on this is exciting. Read More

About the Site from Thinkless Static on June 9, 2004 2:49 AM

A colophon of sorts. Read More

6 Comments

Thanks a bunch for the include_date and glue attributes.

Might want to document that include date needs an ="1" to work correctly.

is there a reason why the date isn't showing up after i put in the same tag you listed above in your code?

is there a reason why the date isn't showing up after i put in the same tag you listed above in your code?

I'm using RelativeDate on my blog (funferal.org) and have been generally very pleased with it. The only problem I have encountered is that when I post late at night (between midnight and one, or maybe 2, in the morning) the day can be reported wrong - I get two listings of 'yesterday': one listing the entries that are truly from yesterday, and another, above it, listing the new entry.

I have a feeling that the problem could be related to the fact that we are currently in summer savings time, or less likely a flaw in the translation from UTC to Central Time (UTC-6).

Any suggestions?

I'm trying to use RelativeDate on my site, and it is reporting the day what seems to be 13 hours behind the current time set on my blog (UTC + 10 hours). I've tried fiddling with the values in relativedate.pl, but to no avail (I don't know Perl). My blog date is set to the correct time, it's just the reporting of today and yesterday that are out of step.

Any ideas?

Is there a class/function available which obtains the same functionality of this one, for people who are not using MovableType?

Leave a comment

About Me

I am a software developer for Six Apart living outside of Baltimore, MD. I have written a number of plugins for Movable Type, including the award winning MultiBlog, which has (as of MT 4) been integrated into the base application....
More...

Recent Entries

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

  • Feedburner Widget 0.3

    At this point, I am really tempted to drop the ‘Widget’ from the name of the plugin, since it is doing so much more...

  • Feedburner Widget 0.2

    So I finally got around to updating the FeedburnerWidget plugin for MT 4.1 (since I finally got around to upgrading my install to MT 4.1)....

Close