If you want to display your date on your blog like Twitter or Mashable you should follow next steps.
The first trick is to paste the code in your WordPress theme where you want to show the time and date.
For Posts:
<?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'; ?>
Another trick by UpThemes is to create the function. To do so, paste the following into your functions.php file:
function time_ago( $type = 'post' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}
Once done, place the function in your single.php file or custom comment callback function.
<?php echo time_ago(); ?>
The easiest method to display date like (“3 minutes ago” or “2 days ago”) is to download and install WordPress Timeago Plugin.
The last method is very useful if you are not a programmer or you if just don’t want to edit your theme, beeing used even by Mashable.
