zoukankan      html  css  js  c++  java
  • 时间戳转时间

    var addtime =$scope.days;
    var date = new Date($('.curTime').html().replace(/-/g, '/'));
    var new1 = Number(date.getTime()/1000) + Number(addtime)*86400;
    var newTime = timestampToTime(new1);//timestampToTime调用
    $('.data_result').html(newTime)
    // 时间戳转时间
    function timestampToTime(timestamp) {
    var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
    Y = date.getFullYear() + '-';
    M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1)+ '-';
    D = date.getDate() + ' ';
    h = date.getHours() + ':';
    m = date.getMinutes();
    // s = date.getSeconds();
    return Y+M+D+h+m;
    }
  • 相关阅读:
    学习C++的第一天
    2016.12.28
    无主之地
    一种排序
    街区最短问题
    配对类问题
    蛇形填数
    c#unity
    贪心
    台阶
  • 原文地址:https://www.cnblogs.com/loveAline/p/9289254.html
Copyright © 2011-2022 走看看