時間戳計算未來一周,每天,每隔的時間


    $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;
}
}])


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM