Drupal 8 format date

\Drupal::service('date.formatter')->format($timestamp, $type, $format, $timezone, $langcode);
/* $type:  - One of the built-in formats: 
 *  'short', 'medium', 'long', 'html_datetime', 'html_date', 
 *  'html_time', 'html_yearless_date', 'html_week', 'html_month', 'html_year'. 
 */