Relative date posted x days ago

We require two functions for comments and posts. Each display a relative date and instead of ‘posted on 12/04/2014’ it shows: ‘x weeks ago’

/**
 * Snippet Name: Relative date posted x days ago
 * Snippet URL: https://www.wpcustoms.net/snippets/relative-date-posted-x-days-ago/
 */
  function wpc_posts_relative_date () {
echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
}

function wpc_comments_relative_date () {
echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ago';
} 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x