Date.php 537 B

1234567891011121314151617181920
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * QuickForm rule to check a date
  5. * @package chamilo.include
  6. */
  7. class Html_Quickform_Rule_Date extends HTML_QuickForm_Rule
  8. {
  9. /**
  10. * Function to check a date
  11. * @see HTML_QuickForm_Rule
  12. * @param array $date An array with keys F (month), d (day) and Y (year)
  13. * @return boolean True if date is valid
  14. */
  15. function validate($date, $options)
  16. {
  17. $compareDate = create_function('$a', 'return checkdate($a[\'M\'],$a[\'d\'],$a[\'Y\']);');
  18. return $compareDate($date);
  19. }
  20. }