Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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';
share|improve this answer
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. –  toscho Jun 21 '12 at 9:08
    
Indeed, i18n in dates is a terribly issue. –  Diana Jun 21 '12 at 17:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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