對象我想獲得一個星期的星期開始日期。我能夠得到日期,只是返回的日期與當前系統時間有關。例如,如果現在19:20的小時,我得到的周開始日期爲Date {Mon Mar 26 2012 19:20:16 GMT + 0530(IST)}獲取日期()的具體時間
爲了精確計算,我需要時間是格林尼治標準時間00:00:00。
我該如何做到這一點?
我當前的代碼如下所示:
var tDate = new Date();
var wDate = new Date();
this.chosenDayIndex = this.currentDayIndex = tDate.getDay();
if (this.currentDate == '') {
this.currentDate = new Date();
var today = formatDate(tDate);
var diff = tDate.getDate() - this.currentDayIndex + (this.currentDayIndex == 0 ? -6:1);
this.weekStartDate = this.weekMonDate = new Date(wDate.setDate(diff));
this.weekEndDate = new Date(this.weekStartDate.getFullYear(),this.weekStartDate.getMonth(), this.weekStartDate.getDate()+6);
this.weekMonday = formatDate(this.weekMonDate);
}
this.weekStartDate目前發放假起始日期與當前時間戳。
日期對象具有'調用setHours()','setMinutes()','調用setSeconds()',等 – Pointy 2012-03-30 13:57:17