時間轉化 Thu Apr 29 2021 16:23:29 GMT+0800


const demand=Thu Apr 29 2021 16:23:29 GMT+0800;
//const demand = this.ruleForm.date2
const resDate = demand.getFullYear() + '-' + this.transTime((demand.getMonth() + 1)) + '-' + this.transTime(demand.getDate()) + ' '
const resTime = this.transTime(demand.getHours()) + ':' + this.transTime(demand.getMinutes()) + ':' + this.transTime(demand.getSeconds())
console.log(resDate+resTime)// 2021-04-29 16:23:29

transTime(s) {
return s < 10 ? '0' + s : s
},


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM