function date_day_of_week in Date 6
Same name and namespace in other branches
- 5.2 date_api.module \date_day_of_week()
- 6.2 date_api.module \date_day_of_week()
- 7.3 date_api/date_api.module \date_day_of_week()
- 7 date_api/date_api.module \date_day_of_week()
- 7.2 date_api/date_api.module \date_day_of_week()
Returns day of week for a given date (0 = Sunday).
Parameters
mixed $date: a date, default is current local day
string $type: The type of date, DATE_ISO, DATE_DATETIME, or DATE_UNIX
Return value
the number of the day in the week
2 calls to date_day_of_week()
- date_day_of_week_name in ./
date_api.module - Returns translated name of the day of week for a given date.
- date_php4.inc in date_php4/
date_php4.inc
File
- ./
date_api.module, line 685 - This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.
Code
function date_day_of_week($date = NULL, $type = DATE_OBJECT) {
if (empty($date)) {
$date = date_now();
$type = DATE_OBJECT;
}
$date = date_convert($date, $type, DATE_OBJECT);
if (is_object($date)) {
return date_format($date, 'w');
}
return NULL;
}