format_date

function format_date

format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL)

Formats a date, using a date type or a custom date format string.

Parameters

$timestamp: A UNIX timestamp to format.

$type: (optional) The format to use, one of:

  • One of the built-in formats: 'short', 'medium', 'long', 'html_datetime', 'html_date', 'html_time', 'html_yearless_date', 'html_week', 'html_month', 'html_year'.
  • The name of a date type defined by a date format config entity.
  • The machine name of an administrator-defined date format.
  • 'custom', to use $format.

Defaults to 'medium'.

$format: (optional) If $type is 'custom', a PHP date format string suitable for input to 登录查看完整内容