PHP date comparision


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $exp_date = "2006-01-16";
  2. $todays_date = date("Y-m-d");
  3. $today = strtotime($todays_date);
  4. $expiration_date = strtotime($exp_date);
  5.  
  6. if ($expiration_date > $today) {
  7. $valid = "yes";
  8. } else {
  9. $valid = "no";
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.