function date_validate

Validates the date type to prevent invalid dates (e.g., February 30, 2006).

Related topics

1 string reference to 'date_validate'
system_element_info in modules/system/system.module
Implements hook_element_info().

File

includes/form.inc, line 3153

Code

function date_validate($element) {
    if (!checkdate($element['#value']['month'], $element['#value']['day'], $element['#value']['year'])) {
        form_error($element, t('The specified date is invalid.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.