function date_days_in_month in Date 6.2
Same name and namespace in other branches
- 5.2 date_api.module \date_days_in_month()
- 6 date_api.module \date_days_in_month()
- 7.3 date_api/date_api.module \date_days_in_month()
- 7 date_api/date_api.module \date_days_in_month()
- 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()
- DateAPITestCase::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 933 - 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';
// Just number of days calculation. No need to worry about timezone.
$date = date_create($datetime);
return date_format($date, 't');
}