现在获取的是1970年1月1日代码为: <script type="text/javascript">
                      function showSelectTimeBox (id) {
                        var ele;
                        if(id&&document.getElementById(id)){
                          ele = document.getElementById(id);
                        }
                        else{
                          ele = document.getElementById('selectTimeBox');
                        }
                        if(ele.style.display == 'block') return;
                        ele.style.display = 'block';
                        var allHeight = ele.offsetHeight;
                        ele.style.height = '1px';
                        (function(){
                          if(ele.offsetHeight<allHeight){
                            ele.style.height = (parseInt(ele.style.height) + 20) +'px';
                            setTimeout(arguments.callee,20);
                          }
                          else{
                            ele.style.height = 'auto';
                          }
                        })();
                      }
                      //根据今天的日期初始化
                      (function(){
                        var serverTime = '{$flow_time}000';
                        var time = serverTime ? new Date(parseInt(serverTime)):new Date();
                        var month = time.getMonth()+1;
                        if(month.length==1) month = '0'+month;
                        var day = time.getDay();
                        var date = time.getDate();
                        var hour = time.getHours();
                        if(date<10) date = '0'+date;                        var html = '';
                        var number = ['日','一','二','三','四','五','六'];
                        for(var i=0; i<7; i++){
                          if(i==0){
                            html += '<ul>';
                            if(day==6||day==0){
                              html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
                            }
                            else{
                              html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
                            }
                            if(day==0){
                                html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                                html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                                html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                            }
                            else{
                                if(hour<1){
                                  html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                                }
                                else if(hour<13){
                                  html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                                }
                                else{
                                  html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                                  html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                                }
                            }
                            html += '</ul>';
                          }
                          else{
                            html += '<ul>';
                            if(day==6||day==0){
                              html += '<li class="top"><strong>周'+ number[day] +' '+ month +'.'+ date +'</strong></li>';
                            }
                            else{
                              html += '<li class="top">周'+ number[day] +' '+ month +'.'+ date +'</li>';
                            }
                            if(day==0){
                              html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                              html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                              html += '<li><a class="disabled" title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                            }
                            else{
                              html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  上午09:30-12:00" href="javascript:;"><i class="dot"></i></a></li>';
                              html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  下午13:00-17:00" href="javascript:;"><i class="dot"></i></a></li>';
                              html += '<li><a title="周'+ number[day] +' '+ month +'.'+ date +'  傍晚17:00-19:00" href="javascript:;"><i class="dot"></i></a></li>';
                            }
                            html += '</ul>';
                          }                          time.setDate(parseInt(date,10)+1);
                          month = time.getMonth()+1;
                          if(month<10) month = '0'+month;
                          day = time.getDay();
                          date = time.getDate();
                          if(date<10) date = '0'+date;
                        }
                        document.getElementById('selectTimeUlBox').innerHTML = html;
                      })();
                      //给所有a绑定点击函数
                      (function(){
                        var as = document.getElementById('selectTimeUlBox').getElementsByTagName('a');
                        function clearSelect(){
                          for(var i=0; i<as.length; i++){
                            if(as[i].className!='disabled'){
                              as[i].className = '';
                            }
                          }
                        }
                        for(var i=0; i<as.length; i++){
                          if(as[i].className != 'disabled'){
                            as[i].onclick = function(){
                              clearSelect();
                              this.className = 'selected';
                              document.getElementById('selectTimeP').innerHTML = this.title;
                              document.getElementById('best_time').value = this.title;
                              document.getElementById('selectTimeBox').style.display = 'none';
                            }
                          }
                        }
                      })();
                      document.body.onclick = function(e){
                        e = e || window.event;
                        var ele = e.target || e.srcElement;
                        var flag = false;
                        while(ele.parentNode != null){
                            if(ele.className=='mod_select'){
                              flag = true;
                              return;
                            }
                            ele = ele.parentNode;
                        }
                        if(!flag) {
                            document.getElementById('selectTimeBox').style.display = 'none';
                        }
                      }
                    </script>
javascript

解决方案 »

  1.   

    http://www.w3school.com.cn/tiy/t.asp?f=jsrf_date_timing_clock
      

  2.   

     var serverTime = '{$flow_time}000'; //这什么意思,后台模板语言会替换?
     
     new Date( 1380369419702 ) //是 1970 年 1 月 1 日午夜之间相间隔的毫秒数。
     或者  new Date( '2013/9/28 00:00' )
     
      

  3.   

    这是ecshop的程序,
    你是意思是要取当前的后台时间?  
    ecshop 不了解,不过 PHP 可以 
    var serverTime = <?php echo time() ?>000000
      

  4.   

    是补3个0
    <?php echo time() ?>000