3

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

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';
  • 1
    +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 Jun 21 '12 at 9:08
  • Indeed, i18n in dates is a terribly issue. – Diana Jun 21 '12 at 17:04

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.