Posted By

wahnbriefe on 11/02/11


Tagged

countDown


Versions (?)

countdown


 / Published in: PHP
 

set variables if before or after key date

  1. <?php
  2. $keyMonth = 11;
  3. $keyDay = 1;
  4. $keyYear = 2011;
  5.  
  6. $month = date(F);
  7. $mon = date(n);
  8. $day = date(j);
  9. $year = date(Y);
  10.  
  11. $hours_left = (mktime(0,0,0,$keyMonth,$keyDay,$keyYear) - time())/3600;
  12. $daysLeft = ceil($hours_left/24);
  13. $z = (string)$daysLeft;
  14.  
  15. if ($z > 0) {
  16. $countdown = 'counting';
  17. } else {
  18. $countdown = 'done';
  19. }
  20. ?>

Report this snippet  

You need to login to post a comment.