时间:2019-05-07 来源:小程序工厂
Math.floor((new Date('2018-10-15')-new Date('2018-10-15'))/1000/60/60/24)+调整天数
onLoad: function (options) {
var date = new Date();
var year = date.getFullYear();
var weekDay = date.getDay();
var month = date.getMonth()+1;
var day = date.getDate();
var d = new Date()
var newDate = d.setFullYear(2019);
console.log(year, month, day, date.toDateString());
var weekArr = ['日', '一', '二', '三', '四', '五', '六'];
this.setData({
start_date: year + '-' + month + '-' + day,
start_week: '星期' + weekArr[weekDay],
end_date: '星期' + weekArr[date.getDay()]
});
},
我写成这样了后面还要怎么写
let day = (new Date('2018-10-15').getTime() - new Date('2017-10-14').getTime()) / (1000 * 60 * 60*24);
console.log(day);