Display time in how long ago format in WordPress
Since Facebook and Twitter became popular, we saw the timestamp of a post like “35 Minutes ago”, “2 Days ago’, “3 Months ago” all the time. In WordPress your could do that by using:
human_time_diff( $from, $to );
For example:
<?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
Written by Yoren Chang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Wordpress
Authors
Related Tags
#wordpress
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#