How can I get comment creation date? How can I get comments creation date of a node and convert it to custom format in my theme, I tried to make some operations on node comments date in "MyTheme.theme" file and in MyTheme_preprocess_comment section.
/**
* Implements hook_preprocess_comment
*/
function THEME_NAME_preprocess_comment(&amp;$variables) {
  // Getting the node creation time stamp from the comment object.
  $date = $variables['comment']-&gt;getCreatedTime();
  // Here you can use drupal's format_date() function, or some custom php date formatting.
  $variables['created'] = \Drupal::service('date.formatter')-&gt;formatInterval(REQUEST_TIME - $date);
  $variables['submitted'] = t('@username commented !datetime', array('@username' =&gt; $variables['author'], '!datetime' =&gt; '&lt;span class="comments-ago"&gt;' . $variables['created'] . ' ago &lt;/span&gt;'));
}