drupal 8 date formater service
snippet in php

drupal 8 date formater service

user4718

\Drupal::service('date.formatter')
    ->format($timestamp, $type, $format, $timezone, $langcode);