class DateHelper

Defines Gregorian Calendar date values.

Lots of helpful functions for use in massaging dates, specific to the Gregorian calendar system. The values include both translated and untranslated values.

Untranslated values are useful as array keys and as css identifiers, and should be listed in English.

Translated values are useful for display to the user. All values that need translation should be hard-coded and wrapped in t() so the translation system will be able to process them.

Hierarchy

File

core/lib/Drupal/Core/Datetime/DateHelper.php, line 19

Namespace

Drupal\Core\Datetime

Members

Name Modifiers Type Description
DateHelper::ampm public static function Constructs an array of AM and PM options.
DateHelper::dayOfWeek public static function Returns day of week for a given date (0 = Sunday).
DateHelper::dayOfWeekName public static function Returns translated name of the day of week for a given date.
DateHelper::days public static function Constructs an array of days in a month.
DateHelper::daysInMonth public static function Identifies the number of days in a month for a date.
DateHelper::daysInYear public static function Identifies the number of days in a year for a date.
DateHelper::hours public static function Constructs an array of hours.
DateHelper::minutes public static function Constructs an array of minutes.
DateHelper::monthNames public static function Returns a translated array of month names.
DateHelper::monthNamesAbbr public static function Constructs a translated array of month name abbreviations
DateHelper::monthNamesAbbrUntranslated public static function Constructs an untranslated array of abbreviated month names.
DateHelper::monthNamesUntranslated public static function Constructs an untranslated array of month names.
DateHelper::seconds public static function Constructs an array of seconds.
DateHelper::weekDays public static function Returns a translated array of week names.
DateHelper::weekDaysAbbr public static function Constructs a translated array of week day abbreviations.
DateHelper::weekDaysAbbr1 public static function Constructs a translated array of 1-letter week day abbreviations.
DateHelper::weekDaysAbbr2 public static function Constructs a translated array of 2-letter week day abbreviations.
DateHelper::weekDaysOrdered public static function Reorders weekdays to match the first day of the week.
DateHelper::weekDaysUntranslated public static function Constructs an untranslated array of week days.
DateHelper::years public static function Constructs an array of years in a specified range.

© 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!DateHelper.php/class/DateHelper/8.1.x