Last Updated: February 25, 2016
·
510
· yoren

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'; ?>