drupal 8 format timestamp into date format code example
Example: drupal 8 date formater service
\Drupal::service('date.formatter')
->format($timestamp, $type, $format, $timezone, $langcode);
\Drupal::service('date.formatter')
->format($timestamp, $type, $format, $timezone, $langcode);