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
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?