时间转为时间戳:
timeToTimestamp (date) {
date = date.replace(/-/g, '/')
let data = new Date(date)
return data.getTime()
}
时间戳转为时间:
timestampToTime (timestamp) {
let date = new Date(timestamp)
let Y = date.getFullYear() + '-'
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate())
let time = Y + M + D
return time
}