2020-03-31时间的转换
2020-03-31 本文已影响0人
夏天的风2020
```
转换时间格式
timeDefault() {
//let date = new Date()
let now = new Date()
let Y = now.getFullYear()
let M = now.getMonth() + 1
let D = now.getDate()
let h = now.getHours()
let m = now.getMinutes()
M < 10 ? M = "0" + M : M = M
D < 10 ? D = "0" + D : D = D
h < 10 ? h = "0" + h : h = h
m < 10 ? m = "0" + m : m = m
//let s1 = `${Y}-${M}-${D} ${h}:${m}:00`
let s1 = `${Y}-${M}-${D}`
return s1
},
```