Drupal 8  8.0.2
DateHelper Class Reference

Static Public Member Functions

static monthNamesUntranslated ()
 
static monthNamesAbbrUntranslated ()
 
static monthNames ($required=FALSE)
 
static monthNamesAbbr ($required=FALSE)
 
static weekDaysUntranslated ()
 
static weekDays ($required=FALSE)
 
static weekDaysAbbr ($required=FALSE)
 
static weekDaysAbbr2 ($required=FALSE)
 
static weekDaysAbbr1 ($required=FALSE)
 
static weekDaysOrdered ($weekdays)
 
static years ($min=0, $max=0, $required=FALSE)
 
static days ($required=FALSE, $month=NULL, $year=NULL)
 
static hours ($format= 'H', $required=FALSE)
 
static minutes ($format= 'i', $required=FALSE, $increment=1)
 
static seconds ($format= 's', $required=FALSE, $increment=1)
 
static ampm ($required=FALSE)
 
static daysInMonth ($date=NULL)
 
static daysInYear ($date=NULL)
 
static dayOfWeek ($date=NULL)
 
static dayOfWeekName ($date=NULL, $abbr=TRUE)
 

Detailed Description

Defines Gregorian Calendar date values.

Member Function Documentation

static ampm (   $required = FALSE)
static

Constructs an array of AM and PM options.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of AM and PM options.

References t().

Here is the call graph for this function:

static dayOfWeek (   $date = NULL)
static

Returns day of week for a given date (0 = Sunday).

Parameters
mixed$date(optional) A DrupalDateTime object or a date string. Defaults to NULL, which means use the current date.
Returns
int The number of the day in the week.
static dayOfWeekName (   $date = NULL,
  $abbr = TRUE 
)
static

Returns translated name of the day of week for a given date.

Parameters
mixed$date(optional) A DrupalDateTime object or a date string. Defaults to NULL, which means use the current date.
string$abbr(optional) Whether to return the abbreviated name for that day. Defaults to TRUE.
Returns
string The name of the day in the week for that date.
static days (   $required = FALSE,
  $month = NULL,
  $year = NULL 
)
static

Constructs an array of days in a month.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
int$month(optional) The month in which to find the number of days. Defaults to NULL.
int$year(optional) The year in which to find the number of days. Defaults to NULL.
Returns
array An array of days for the selected month.
static daysInMonth (   $date = NULL)
static

Identifies the number of days in a month for a date.

Parameters
mixed$date(optional) A DrupalDateTime object or a date string. Defaults to NULL, which means to use the current date.
Returns
int The number of days in the month.
static daysInYear (   $date = NULL)
static

Identifies the number of days in a year for a date.

Parameters
mixed$date(optional) A DrupalDateTime object or a date string. Defaults to NULL, which means to use the current date.
Returns
int The number of days in the year.
static hours (   $format = 'H',
  $required = FALSE 
)
static

Constructs an array of hours.

Parameters
string$format(optional) A date format string that indicates the format to use for the hours. Defaults to 'H'.
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of hours in the selected format.

References DateTimePlus\datePad().

Here is the call graph for this function:

static minutes (   $format = 'i',
  $required = FALSE,
  $increment = 1 
)
static

Constructs an array of minutes.

Parameters
string$format(optional) A date format string that indicates the format to use for the minutes. Defaults to 'i'.
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
int$incrementAn integer value to increment the values. Defaults to 1.
Returns
array An array of minutes in the selected format.

References DateTimePlus\datePad().

Here is the call graph for this function:

static monthNames (   $required = FALSE)
static

Returns a translated array of month names.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of month names.

References t().

Here is the call graph for this function:

static monthNamesAbbr (   $required = FALSE)
static

Constructs a translated array of month name abbreviations

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of month abbreviations.

References t().

Here is the call graph for this function:

static monthNamesAbbrUntranslated ( )
static

Constructs an untranslated array of abbreviated month names.

Returns
array An array of month names.
static monthNamesUntranslated ( )
static

Constructs an untranslated array of month names.

Returns
array An array of month names.
static seconds (   $format = 's',
  $required = FALSE,
  $increment = 1 
)
static

Constructs an array of seconds.

Parameters
string$format(optional) A date format string that indicates the format to use for the seconds. Defaults to 's'.
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
int$incrementAn integer value to increment the values. Defaults to 1.
Returns
array An array of seconds in the selected format.

References DateTimePlus\datePad().

Here is the call graph for this function:

static weekDays (   $required = FALSE)
static

Returns a translated array of week names.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of week day names

References t().

Here is the call graph for this function:

static weekDaysAbbr (   $required = FALSE)
static

Constructs a translated array of week day abbreviations.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of week day abbreviations

References t().

Here is the call graph for this function:

static weekDaysAbbr1 (   $required = FALSE)
static

Constructs a translated array of 1-letter week day abbreviations.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of week day 1 letter abbreviations

References t().

Here is the call graph for this function:

static weekDaysAbbr2 (   $required = FALSE)
static

Constructs a translated array of 2-letter week day abbreviations.

Parameters
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of week day 2 letter abbreviations

References t().

Here is the call graph for this function:

static weekDaysOrdered (   $weekdays)
static

Reorders weekdays to match the first day of the week.

Parameters
array$weekdaysAn array of weekdays.
Returns
array An array of weekdays reordered to match the first day of the week. The keys will remain unchanged. For example, if the first day of the week is set to be Monday, the array keys will be [1, 2, 3, 4, 5, 6, 0].

References Drupal\config().

Referenced by DateHelperTest\testWeekDaysOrdered().

Here is the call graph for this function:

Here is the caller graph for this function:

static weekDaysUntranslated ( )
static

Constructs an untranslated array of week days.

Returns
array An array of week day names

Referenced by DateHelperTest\testWeekDaysOrdered().

Here is the caller graph for this function:

static years (   $min = 0,
  $max = 0,
  $required = FALSE 
)
static

Constructs an array of years in a specified range.

Parameters
int$min(optional) The minimum year in the array. Defaults to zero.
int$max(optional) The maximum year in the array. Defaults to zero.
bool$required(optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Returns
array An array of years in the selected range.

The documentation for this class was generated from the following file: