Posted By

_reydin_ on 06/23/12


Tagged

date validate checkdate


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

_reydin_


Validate the date


 / Published in: PHP
 

This will check the date and if it is not a valid date then it will increment the month and reset the day back to one.

  1. Check date function
  2. //Check the date
  3. while(!checkdate($month, $day, $year)){
  4. if($month <= 12 && $day <=31){
  5. $month++;
  6. $day = 1;
  7. }else{
  8. $year++;
  9. $month = 1;
  10. $day = 1;
  11. }
  12. }

Report this snippet  

You need to login to post a comment.