public static function DateHelper::dayOfWeek in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::dayOfWeek()
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.
Return value
int The number of the day in the week.
1 call to DateHelper::dayOfWeek()
- DateHelper::dayOfWeekName in core/
lib/ Drupal/ Core/ Datetime/ DateHelper.php - Returns translated name of the day of week for a given date.
File
- core/
lib/ Drupal/ Core/ Datetime/ DateHelper.php, line 504 - Contains \Drupal\Core\Datetime\DateHelper.
Class
- DateHelper
- Defines Gregorian Calendar date values.
Namespace
Drupal\Core\DatetimeCode
public static function dayOfWeek($date = NULL) {
if (!$date instanceof DrupalDateTime) {
$date = new DrupalDateTime($date);
}
if (!$date
->hasErrors()) {
return $date
->format('w');
}
return NULL;
}