做项目经常会用到的3种时间处理,都已经做好封装,直接调用传值即可。
- 毫秒数转年月日时分秒
toDate(str) {
let times = new Date(str);
let Y = times.getFullYear()
let M = times.getMonth()+1<10?'0'+(times.getMonth()+1):times.getMonth()+1
let D = times.getDate()<10?'0'+(times.getDate()):times.getDate()
let h = times.