public static function PersianDateHelper::daysInMonth in Persian Date for Drupal 8 8.4
Same name and namespace in other branches
- 8 src/PersianDateHelper.php \Drupal\persian_date\PersianDateHelper::daysInMonth()
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.
Return value
int The number of days in the month.
Overrides DateHelper::daysInMonth
File
- src/
PersianDateHelper.php, line 440
Class
Namespace
Drupal\persian_dateCode
public static function daysInMonth($date = NULL) {
if (!$date instanceof DrupalDateTime) {
$date = new DrupalDateTime($date);
}
if (!$date
->hasErrors()) {
return $date
->format('t');
}
return NULL;
}