Created
February 19, 2018 15:53
-
-
Save midnai/db93d1aaa93121564460a443b9ad77b8 to your computer and use it in GitHub Desktop.
Drupal 8 - Format a timestamp to a custom format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function formatDate($date) | |
{ | |
$date = new \DateTime($date); | |
$date = $date->getTimestamp(); | |
return \Drupal::service('date.formatter')->format($date, '', 'd \d\e F \d\e Y'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment