/ Published in: PHP
I've been using a Javascript to do the same thing for years but have always wanted to do the same thing in PHP -- just never got around to writing it. Fortunately, ScriptyGoddess did it for me. Haven't actually implemented it but it looks like it should work.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? // enter start date below like this: "January 2, 2001" $start = "January 29, 2002"; // enter string of what this start date is. $text = "have passed since I had a fulltime job."; //-------------------------- $difference = $now - $then ; $num = $difference/86400; $num2 = ($num - $days)*24; $num3 = ($num2 - $hours)*60; $num4 = ($num3 - $mins)*60; ?> <p> <? echo $days ?> days, <? echo $hours ?> hours, <? echo $mins ?> minutes, <? echo $secs ?> seconds <? echo $text ?> </p>
URL: http://www.scriptygoddess.com/archives/2002/05/23/count-up-timer-in-php/