3

I want display date based on how much time has passed since, i. e. Posted 12 minutes ago

1 Answer 1

6

This is quite simple: just replace the get_the_date() or the_date() with

echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
2
  • 2
    +1 for sharing what you learned. :) Do not use this function in a theme or plugin you want to distribute internationally. Correct translation is almost impossible. See also ticket #9272 for more problems. And you don’t need the second parameter in your example.
    – fuxia
    Commented Jun 21, 2012 at 9:08
  • Indeed, i18n in dates is a terribly issue.
    – Diana
    Commented Jun 21, 2012 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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