You are here

function date_days_in_month in Date 5.2

Same name and namespace in other branches
  1. 6.2 date_api.module \date_days_in_month()
  2. 6 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.

4 calls to date_days_in_month()
DateAPI::testDateAPI in tests/date_api.test
date_select_validate in ./date_api_elements.inc
Validation function for date selector.
date_sql_handler::complete_date in ./date_api_sql.inc
Create a complete datetime value out of an incomplete array of selected values.
date_valid_day in ./date_api.module

File

./date_api.module, line 716
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($year, $month) {

  // Pick a day in the middle of the month to avoid timezone shifts.
  $datetime = date_pad($year, 4) . '-' . date_pad($month) . '-15 00:00:00';
  $date = date_make_date($datetime);
  return date_format($date, 't');
}