前几天用到此需求,记录一下
getmyDate() {
var date = new Date();
date.setDate(date.getDate() + 5);
var year = date.getFullYear().toString();
var month = (date.getMonth()+1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1).toString();
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate().toString();
var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours().toString();
var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes().toString();
var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds().toString();
let lastLoadingTime = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
this.changeOrder({
lastLoadingTime: lastLoadingTime
})
};
这样就可以了 可自行更改
网友评论