format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL,$langcode= NULL)
Formats a date, using a date type or a custom date format string.
$timestamp: A UNIX timestamp to format.
$type: (optional) The format to use, one of:
Defaults to 'medium'.
$format: (optional) If $type is 'custom', a PHP date format string suitable for input to date(). Use a backslash to escape ordinary text, so it does not get interpreted as date format characters.
$timezone: (optional) Time zone identifier, as described at http://php.net/manual/timezones.php Defaults to the time zone used to display the page.
$langcode: (optional) Language code to translate to. Defaults to the language used to display the page.
A translated date string in the requested format.
in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \Drupal::service('date.formatter')->format().
\Drupal\Core\Datetime\DateFormatter::format()
function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { return \Drupal::service('date.formatter')->format($timestamp, $type, $format, $timezone, $langcode); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!common.inc/function/format_date/8.1.x