时间转化 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