JS 时间戳转化为时间格式

  function getLocalTime(nS) {
            return new Date(parseInt(nS)).toLocaleString().replace(/:\d{1,2}$/, ' ').replace("年", '-').replace("月", '-').replace("日", '').substring(0, 10);
        }

  转化出来的时间格式为  yyyy-MM-dd

posted on 2014-11-20 10:56  战马  阅读(212)  评论(0)    收藏  举报

导航