Advertisement
pusatdata

Create a PHP Countdown Timer

Oct 27th, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Create a PHP Countdown Timer
  2. http://www.programminghelp.com/php/create-php-countdown-timer/
  3.  
  4. <!doctype html>
  5. <html>
  6. <head>
  7. <title>PHP Countdown Timer</title>
  8. <style>
  9. .green{color:green;}
  10.  
  11. h1{
  12. font-size:3em;
  13. font-weight:bold;
  14. font-family:Arial, Helvetica, sans-serif;
  15. }
  16.  
  17. </style>
  18. </head>
  19. <body>
  20. <?php
  21. $date = strtotime("December 3, 2014 2:00 PM");
  22. $remaining = $date - time();
  23. $days_remaining = floor($remaining / 86400);
  24. $hours_remaining = floor(($remaining % 86400) / 3600);
  25. ?>
  26.  
  27. <h1>There are <span class="green"> <?php echo $days_remaining?></span> days and <span class="green"> <?php echo $hours_remaining?></span> hours left</h1>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement