public static DateHelper::daysInMonth($date = NULL)
Identifies the number of days in a month for a date.
mixed $date: (optional) A DrupalDateTime object or a date string. Defaults to NULL, which means to use the current date.
int The number of days in the month.
public static function daysInMonth($date = NULL) { if (!$date instanceof DrupalDateTime) { $date = new DrupalDateTime($date); } if (!$date->hasErrors()) { return $date->format('t'); } 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::daysInMonth/8.1.x