php和js一起实现倒计时功能

里获取的php服务端的时间 纯JS是获取客服端时间!

<?php
    //php的时间是以秒算。js的时间以毫秒算
    date_default_timezone_set('PRC');
    //date_default_timezone_set("Asia/Hong_Kong");//地区
 
    $timestr = "2015-4-3 18:50:00";//倒计时时间
    $time = strtotime($timestr);//时间戳
    $nowtime = time();//当前时间戳
 
    if ($time>=$nowtime){
        $overtime = $time-$nowtime; //实际剩下的时间(单位/秒)
    }else{
        $overtime=0;
    }
?>
 
<script language="JavaScript">
    var runtimes = 0;
    function GetRTime(){
        var nMS = <?php echo $overtime; ?>*1000-runtimes*1000;
 
        if (nMS>=0){
            var nD=Math.floor(nMS/(1000*60*60*24))%24;
            var nH=Math.floor(nMS/(1000*60*60))%24;
            var nM=Math.floor(nMS/(1000*60)) % 60;
            var nS=Math.floor(nMS/1000) % 60;
            document.getElementById("RemainD").innerHTML=nD;
            document.getElementById("RemainH").innerHTML=nH;
            document.getElementById("RemainM").innerHTML=nM;
            document.getElementById("RemainS").innerHTML=nS;
            runtimes++;
            if(nD==0){
                //天数0 隐藏天数
                document.