97zhaodashuai
3/18/2020 - 3:49 PM

js 获取间隔的天数


    getDate(day) {

        var dateTime = new Date();
        dateTime = dateTime.setDate(dateTime.getDate() - day);
        var now = new Date(dateTime);

        var year = now.getFullYear();        //年
        var month = now.getMonth() + 1;      //月
        var day = now.getDate();             //日

        return year + '-' + month + '-' + day

    },