zoukankan      html  css  js  c++  java
  • js获取当前时间格式化字符串

    var today = new Date();

    var month = today.getMonth() + 1;

    month = month < 10 ? '0'+month : month;

    var day = today.getDate() < 10 ? '0'+today.getDate() : today.getDate();

    var hours = today.getHours() < 10 ? '0'+today.getHours() : today.getHours();

    var mins = today.getMinutes() < 10 ? '0'+today.getMinutes() : today.getMinutes();

    var secs = today.getSeconds() < 10 ? '0'+today.getSeconds() : today.getSeconds();

    var now1 = today.getFullYear() + '/' + month + '/' + day;

    var now1 = today.getFullYear() + '/' + month + '/' + day + “ ” + hours + ":" + mins + ":" + secs ;

  • 相关阅读:
    053403
    053402
    053401
    053400
    053399
    053398
    053397
    053396
    053395
    第k小数
  • 原文地址:https://www.cnblogs.com/will-666/p/11564090.html
Copyright © 2011-2022 走看看