Ich möchte Woche Startdatum einer Woche bekommen. Ich bin in der Lage, das Datum zu bekommen, es ist nur, dass das Datum zurückgegeben hat Zeit in Bezug auf die aktuelle Systemzeit. Zum Beispiel, wenn seine 19.20 Uhr gerade jetzt, ich bin die Woche Startdatum als Datum bekommen {Mo 26. März 2012 19.20.16 GMT + 0530 (IST)}Get Date() Objekt mit bestimmter Zeit
Für genaue Berechnungen, ich brauche Die Zeit ist 00:00:00 GMT.
Wie kann ich das erreichen?
Meine aktuellen Code sieht wie folgt aus:
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 derzeit übergibt den falschen Startdatum mit dem aktuellen Zeitstempel aus.
Date-Objekte haben 'setHours()', 'setMinutes()', 'setSeconds()' usw. – Pointy