Identifies the number of days in a year for a date.
mixed $date: (optional) A date object, timestamp, or a date string. Defaults to NULL, whcih means to use the current date.
int The number of days in the year.
public static function daysInYear($date = NULL) {
if (!$date instanceof DrupalDateTime) {
$date = new DrupalDateTime($date);
}
if (!$date
->hasErrors()) {
if ($date
->format('L')) {
return 366;
}
else {
return 365;
}
}
return NULL;
}