获取每天的前一天时间,(时间根据当前会自动减一天日期)

getCurentTime(-1, ‘-’);
//获取昨天时间
getCurentTime: function (num, str) {
var _that = indexObj;
var today = new Date();
var nowTime = today.getTime();
var ms = 24 * 3600 * 1000 * num;
today.setTime(parseInt(nowTime + ms));
var oYear = today.getFullYear();
var oMoth = (today.getMonth() + 1).toString();
if (oMoth.length <= 1) oMoth = ‘0’ + oMoth;
var oDay = today.getDate().toString();
if (oDay.length <= 1) oDay = ‘0’ + oDay;
_that.yesterdayData.yesterDay = oMoth + str + oDay;
},

你可能感兴趣的:(pc端,移动端,js,时间,Data)