// 时间戳转时间格式
export const getTime = (dateTime = '') => {
let time = ""
let now = dateTime ? new Date(dateTime) : new Date()
let year = now.getFullYear() //年份
let month = now.getMonth() //月份
let date = now.getDate() //日期
month = month + 1
if (month < 10) month = "0" + month
if (date < 10) date = "0" + date
return time = `${year}-${month}-${date}`
}
// 标准时间改字符串格式
export const getStringTime = (dateTime) => {
let date = new Date(dateTime)
let yyyy = date.getFullYear()
let mm = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)
let dd = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return yyyy + '-' + mm + '-' + dd;
}
//今天的日期
var today = new Date();
today.setTime(today.getTime());
var todayStr = today.getFullYear()+"-" + (today.getMonth()+1) + "-" + today.getDate();
//明天的日期
var tomorrow = new Date();
tomorrow.setTime(tomorrow.getTime() + 24*60*60*1000);
var tomorrowStr = tomorrow.getFullYear()+"-"+(tomorrow.getMonth()+1)+"-"+tomorrow.getDate();