时间戳转换

1
2
3
4
5
6
7
8
9
10
timestampToTime(timestamp) {
    var date = new Date(timestamp);
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var D = date.getDate() + ' ';
    var h = date.getHours() + ':';
    var m = date.getMinutes() + ':';
    var s = date.getSeconds();
    return Y+M+D+h+m+s;
}

  

posted @   仙乄  阅读(233)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示