把el-date-picker的中国标准时间转化为年月日时分秒
(1条消息) 把el-date-picker的中国标准时间转化为年月日时分秒_el-date-picker 根据日期转化为年月日_不想学习只想玩的博客-CSDN博客
standardTime(data) {
if (data === null) {
return ''
}
const date = new Date(data)
const year = date.getFullYear()
let month = date.getMonth() + 1
month = month < 10 ? "0" + month : month
let day = date.getDate()
day = day < 10 ? "0" + day : day
let hour = date.getHours()
hour = hour < 10 ? "0" + hour : hour
let minute = date.getMinutes()
minute = minute < 10 ? "0" + minute : minute
let second = date.getSeconds()
second = second < 10 ? "0" + second : second
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
},
var startTime = typeof this.importData.searchParams.surveyStartDate != "object" ? this.importData.searchParams.surveyStartDate : this.standardTime(this.importData.searchParams.surveyStartDate)