You are here

function date_days_in_month in Date 6

Same name and namespace in other branches
  1. 5.2 date_api.module \date_days_in_month()
  2. 6.2 date_api.module \date_days_in_month()
  3. 7.3 date_api/date_api.module \date_days_in_month()
  4. 7 date_api/date_api.module \date_days_in_month()
  5. 7.2 date_api/date_api.module \date_days_in_month()

Identify the number of days in a month for a date.

Parameters

mixed $date:

Return value

integer

1 call to date_days_in_month()
DateAPI::testDateAPI in tests/date_api.test

File

./date_api.module, line 617
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_days_in_month($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, 't');
  }
  return NULL;
}