时间戳计算未来一周,每天,每隔的时间

    $scope.transformer = function(hour, minute, loopTime, weekType){
var now = new Date();
if (weekType == undefined) {
weekType = now.getDay();
}
//转化到秒
var difference = (now.getDay() * 24 * 60 * 60 + now.getHours() * 60 *60 + now.getMinutes()*60+now.getSeconds())
- (weekType * 24 * 60 *60+ hour * 60 *60+ minute*60);
var timestamp = now.getTime();
//增加loopTime天
if (difference > 0) {
timestamp += loopTime * 24 * 60 * 60 * 1000;
}
timestamp -= difference * 1000;
var timeResult =parseInt(timestamp/1000);
return timeResult;
}
}])

转载于:https://www.cnblogs.com/jessical626/p/6822357.html

你可能感兴趣的:(时间戳计算未来一周,每天,每隔的时间)