Is there a way to format the date output so it reads like it does on Twitter or Facebook.

For example if a post was posted 2 days ago the output would be '2 days ago', the same goes for weeks, so if the entry was posted 2 weeks ago it says '2 weeks ago'.

I only need it to go up to 2 weeks, after that it will switch back to a normal date format.



There are at least three plugins that can format dates like "x time-units ago."

Since you only need display a relative date for the first two weeks from the entry date, you'll need to wrap your date in a conditional based on {current_time} and use a bit of math. Or as you pointed out in your comment, the Time Ago plugin has a revert_to_date_format parameter for this purpose.

  • 1
    Thanks, Time Ago has a great solution with the revert_to_date_format option, i can just modify the add-on to make it work with 14 days
    – zizther
    Mar 13 '13 at 15:32
  • Ah, nice! Very useful option.
    – Alex Kendrick
    Mar 13 '13 at 17:16

There are several such add-ons listed on devot:ee. Here's a search for "relative date."


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.