Posted By

morroida on 06/18/08


Tagged

php date compare


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

brent-man
jamesming
fackz


PHP date comparision


 / Published in: PHP
 

  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  

You need to login to post a comment.