You are here

function date_valid_day in Date 5.2

Same name and namespace in other branches
  1. 6.2 date_api.module \date_valid_day()
1 call to date_valid_day()
date_is_valid in ./date_api.module
Functions to test the validity of a date in various formats. Has special case for ISO dates and arrays which can be missing month and day and still be valid.

File

./date_api.module, line 1268
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_valid_day($day, $month = NULL, $year = NULL) {
  $days_in_month = !empty($month) && !empty($year) ? date_days_in_month($year, $month) : 31;
  if ($days_in_month < $day || 1 > $day) {
    return FALSE;
  }
  else {
    return TRUE;
  }
}