Realize Countdown using PHP and JavaScript
<p>I want to write a countdown, which get the time from a server (php) and then counts down on the client side (JavaScript). Unfortunately I have only a few experience with JavaScript or JQuery. At this time the script looks like this:</p>

<pre><code>&lt;?php 
    $endTime = mktime(00, 00, 00, 01, 01, 2012); 
    $actTime = time(); 
    $difTime = $endTime - $actTime;
    $seconds = $difTime;
?&gt;

&lt;script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
   $(document).ready(function(){
            window.setInterval(function() {
                var seconds = $('div#timer').html();                    
                var updateTime = eval(seconds)- eval(1);                    
                $('div#timer').html(updateTime);
            }, 1000);

    });
&lt;/script&gt;

&lt;div id="timer"&gt;&lt;?php echo $seconds ?&gt;&lt;/div&gt;
</code></pre>

<p></p>

<p>Now I want to convert the remaining seconds into days, months, minutes and seconds. However, I do not really know how I should realize that with the function
setInterval. Can anyone help me? Maybe there are better ways as working with the UNIX-Timestamp? </p>

<p>Thank you in advance!</p>

<p>Martin</p>
