// 获取当前时间
getNowTime() {
const yy = new Date().getFullYear()
const MM = (new Date().getMonth() + 1) < 10 ? '0' + (new Date().getMonth() + 1) : (new Date().getMonth() + 1)
const dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
const HH = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours()
const mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
this.$set(this.formData, 'registerDate', yy + '-' + MM + '-' + dd + ' ' + HH + ':' + mm + ':' + ss)
},
获取当前时间,年月日时分秒
最新推荐文章于 2024-08-01 14:07:52 发布
本文介绍了一种使用JavaScript获取并格式化当前时间的方法,包括年、月、日、时、分和秒,适用于需要记录精确注册时间的应用场景。

4万+

被折叠的 条评论
为什么被折叠?



