Codex tools: Log in
Contents |
Determines the difference between two timestamps.
The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days".
<?php human_time_diff( $from, $to ); ?>
To print an entry's time ("2 days ago"):
<?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
For comments:
<?php echo human_time_diff( get_comment_time('U'), current_time('timestamp') ) . ' ago'; ?>
Since: 1.5.0
human_time_diff() is located in wp-includes/formatting.php.