Articles
Ce document est aussi disponible en français
Validating a date is a common task, especially on the web, through forms. Thanksfully, checkdate() is up to the job.
checkdate() checks that a date has
valide values, in Gregorian calendar. Its major advantage is that checkdate() will take into
account leap years.
Example 1 : check different dates
<?php var_dump(checkdate(12, 31, 2000)); // TRUE var_dump(checkdate(2, 29, 2001)); // FALSE ?>
Keep in mind
- checkdate() has been available since PHP 4
- mktime() would accept 2/29/2001, but turn it automatically into 3/1/2001
| < Précédent | Suivant > |
|---|
Commentaires
Vous pouvez ajouter votre commentaire! |
Vous devez vous connecter pour commenter


