public static function DateHelper::dayOfWeek
public static DateHelper::dayOfWeek($date = NULL)
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.
File
- core/lib/Drupal/Core/Datetime/DateHelper.php, line 501
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; }
© 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/function/DateHelper::dayOfWeek/8.1.x