週を取得したいStart Date of week。私は日付を取得することができます、それはちょうど返された日付が現在のシステム時刻に時間を持っていることです。例えば、その夜07時20分時間が今、私は日として、週の開始日を取得していた場合、{月2012年3月26日十九時20分16秒GMT + 0530(IST)}正確な計算のために特定の時刻のDate()オブジェクトを取得する
、私が必要00:00:00 GMTになる時間。
どうすれば実現できますか?
私の現在のコードは次のようになります。
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