Drupal 8  8.0.2


 format_size ($size, $langcode=NULL)
 format_date ($timestamp, $type= 'medium', $format= '', $timezone=NULL, $langcode=NULL)
 date_iso8601 ($date)

Detailed Description

End of "defgroup sanitization".

Functions to format numbers, strings, dates, etc.

Function Documentation

date_iso8601 (   $date)

Returns an ISO8601 formatted date based on the given date.

$dateA UNIX timestamp.
string An ISO8601 formatted date.
format_date (   $timestamp,
  $type = 'medium',
  $format = '',
  $timezone = NULL,
  $langcode = NULL 

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

$timestampA 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 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.
See Also
in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use ::service('date.formatter')->format().

Referenced by CommentAttributesTest\_testBasicCommentRdfaMarkup(), FilterDateTest\_testBetween(), StandardProfileTest\assertRdfaCommonNodeProperties(), StandardProfileTest\assertRdfaNodeCommentProperties(), CommentTranslationUITest\doTestAuthoringInfo(), NodeTranslationUITest\doTestAuthoringInfo(), ContentTranslationUITestBase\doTestAuthoringInfo(), ContentTranslationHandler\entityFormAlter(), NodeTranslationHandler\entityFormEntityBuild(), NodeRevisionDeleteForm\getQuestion(), Date\render(), NodeController\revisionPageTitle(), NodeRevisionDeleteForm\submitForm(), FormatDateTest\testAdminDefinedFormatDate(), LocaleConfigTranslationTest\testConfigTranslation(), DateTimeFieldTest\testDateField(), ConfigTranslationUiTest\testDateFormatTranslation(), DateTimeFieldTest\testDatetimeField(), SearchExactTest\testExactQuery(), FieldDateTest\testFieldDate(), FormatDateTest\testFormatDate(), LocaleUpdateInterfaceTest\testInterface(), NodeRevisionsUiTest\testNodeRevisionDoubleEscapeFix(), NodeRevisionsAllTest\testRevisions(), NodeRevisionsTest\testRevisions(), StatisticsTokenReplaceTest\testStatisticsTokenReplacement(), LocaleUpdateTest\testUpdateImportSourceRemote(), UserTokenReplaceTest\testUserTokenReplacement(), YearMonthDate\title(), FullDate\title(), MonthDate\title(), and DayDate\title().

Here is the caller graph for this function:

format_size (   $size,
  $langcode = NULL 

Generates a string representation for the given byte count.

$sizeA size in bytes.
$langcodeOptional language code to translate to a language other than what is used to display the page.
A translated string representation of the size.

Referenced by WebTestBase\curlExec(), FileItem\fieldSettingsForm(), FormAjaxSubscriber\formatSize(), MigrateExecutable\formatSize(), FileWidgetAjaxController\progress(), FileSize\render(), SizeUnitTest\testCommonFormatSize(), SizeUnitTest\testCommonParseSizeFormatSize(), FileFieldValidateTest\testFileMaxSize(), TableFormatter\viewElements(), and FileSize\viewElements().

Here is the caller graph for this function: