美文网首页
JS格式化Thu May 12 2017 08:00:00 GM

JS格式化Thu May 12 2017 08:00:00 GM

作者: 张鸽 | 来源:发表于2018-07-20 11:48 被阅读0次
    <script type="text/javascript">
        function checkTime(i){
           if (i<10){
               i="0" + i
           }
           return i;
        }
        var date = new Date('Thu May 12 2017 08:00:00 GMT+0800 (中国标准时间)');  
        date_value=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + checkTime(date.getHours()) + ':' + checkTime(date.getMinutes()) + ':' + checkTime(date.getSeconds());  
        //最后显示yyyy-MM-dd hh:mm:ss  
    </script>
    
    效果图

    相关文章

      网友评论

          本文标题:JS格式化Thu May 12 2017 08:00:00 GM

          本文链接:https://www.haomeiwen.com/subject/qbmfmftx.html