How do I customize the date-submit part in comment section? I am formatting the Date/Submit part of the comment. By default when we post any comment, it comes in the format of,
Submitted by author-name on Sun, 06/12/2016 - 20:34. I am using Adaptive theme.

I would like to change (1) date part in the ago format, like

1 minute ago

24 minutes ago

an hour ago

2 hours ago

1 day ago

20 days ago

1 month ago

1 year ago

etc...

AND the (2) Sentence part as described below,

From Submitted by author-name on Sun, 06/12/2016 - 20:34 To
author-name ------- ago

Now, Sentence part I did achieve as described below,


I did some change in comment.tpl.php as shown below


From->

&lt;?php if ($picture || $submitted): ?&gt;
&lt;footer&lt;?php print $footer_attributes; ?&gt;&gt;
  &lt;?php print $picture; ?&gt;
  &lt;p class="author-datetime"&gt;&lt;?php print $submitted; ?&gt;&lt;/p&gt;
&lt;/footer&gt;


  

To->

&lt;?php if ($picture || $submitted): ?&gt;
&lt;footer&lt;?php print $footer_attributes; ?&gt;&gt;
  &lt;?php print $picture; ?&gt;
  &lt;span class="auth"&gt;&lt;?php print $author; ?&gt;&lt;/span&gt;
  &lt;div class="cret"&gt;&lt;p&gt;&lt;?php print $created; ?&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;!--&lt;p class="author-datetime"&gt;&lt;?php print $submitted; ?&gt;&lt;/p&gt;--&gt; &lt;!--I did remove this part, so it can not take the whole submitted by sentence by default--&gt;
&lt;/footer&gt;


  

So, by doing this, I can add author-name separately and date separately, so this will allow me to format the sentence the way I want

Hence now, I am getting,

author-name Sun, 06/12/2016 - 20:34

Now, how can I change the date part. Thanks
You can use format_interval() to do this.

function MYTHEME_preprocess_comment(&amp;$variables) {
  $comment = $variables['elements']['#comment'];
  $variables['created'] = t('@created ago', array(
    '@created' =&gt; format_interval(REQUEST_TIME - $comment-&gt;created),
  ));
}


If you look at the source for template_preprocess_comment(), you are essentially just using format_interval() instead of format_date() to create the timestamps.  In the above, we run everything through t() so that the string "ago" gets translated properly.