ES6,时间格式yyyy-MM-dd HH:MM:SS


    setNowFormatDate() {
      let date = new Date();
      let month = (date.getMonth() + 1).toString().padStart(2,'0');
      let strDate = date.getDate().toString().padStart(2,'0');
      //时间格式yyyy-MM-dd HH:MM:SS
      return `${date.getFullYear()}-${month}-${strDate} ${this.getCurrentTime()}`;
    },
    getCurrentTime() {
      let date = new Date();
      //时间格式HH:MM:SS
      return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
    },

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM