If you want something in real time, you will need to use client-side scripts, namely JavaScript.
You can do this in PHP, but it will not “animate”:
$wedding = strtotime("2011-07-01 12:00:00+0400"); // or whenever the wedding is $secondsLeft = $wedding - time(); $days = floor($secondsLeft / 60*60*24); $hours = floor(($secondsLeft - $days*60*60*24) / 60*60); echo "$days days and $hours hours left";
Within a few months, you could add a few mathematical calculations, but this becomes more useless because a month is not a fixed amount of time.
Another way would be to use the date() function to highlight individual elements (hour, minute, second, day, month, etc.) and use the rollover math, but this is very worrying about the “good effect”.
Let me know if you want to use the JavaScript example. Don't worry about jQuery - this is the canon for killing a mosquito :)
source share