W3cubDocs

/Drupal 8

class DateFormatter

Provides a service to handle various date related functionality.

Hierarchy

Related topics

Internationalization
Internationalization and translation

File

core/lib/Drupal/Core/Datetime/DateFormatter.php, line 18

Namespace

Drupal\Core\Datetime

Members

Name Modifiers Type Description
DateFormatter::$configFactory protected property The configuration factory.
DateFormatter::$country protected property
DateFormatter::$dateFormats protected property
DateFormatter::$dateFormatStorage protected property The date format storage.
DateFormatter::$languageManager protected property Language manager for retrieving the default langcode when none is specified.
DateFormatter::$requestStack protected property The request stack.
DateFormatter::$timezones protected property The list of loaded timezones.
DateFormatter::$units protected property Contains the different date interval units.
DateFormatter::country protected function Returns the default country from config.
DateFormatter::dateFormat protected function Loads the given format pattern for the given langcode.
DateFormatter::format public function Formats a date, using a date type or a custom date format string. Overrides DateFormatterInterface::format
DateFormatter::formatDiff public function Formats a time interval between two timestamps. Overrides DateFormatterInterface::formatDiff
DateFormatter::formatInterval public function Formats a time interval with the requested granularity. Overrides DateFormatterInterface::formatInterval
DateFormatter::formatTimeDiffSince public function Formats the time difference from a timestamp to the current request time. Overrides DateFormatterInterface::formatTimeDiffSince
DateFormatter::formatTimeDiffUntil public function Formats the time difference from the current request time to a timestamp. Overrides DateFormatterInterface::formatTimeDiffUntil
DateFormatter::getSampleDateFormats public function Provides values for all date formatting characters for a given timestamp. Overrides DateFormatterInterface::getSampleDateFormats
DateFormatter::__construct public function Constructs a Date object.
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use.
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

© 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!lib!Drupal!Core!Datetime!DateFormatter.php/class/DateFormatter/8.1.x