Ich bin ein wirklich neuer Programmierer. Ich versuche etwas zu schreiben, das automatisch das Datum auf meine Blätter legt. Wenn die Zeit nach Mitternacht ist und immer noch nicht 6 Uhr, möchte ich das Datum des Vortages. Ist das möglich?Datum ändern, wenn die Stunde nach Mitternacht
Dies ist, was ich bisher habe; Ich bin fest:
var CueectHoure = Utilities.formatDate(new Date(), "Asia/Jerusalem", "HH");
var CurrectDay = Utilities.formatDate(new Date(), "Asia/Jerusalem", "dd");
var CurrectMunth = Utilities.formatDate(new Date(), "Asia/Jerusalem", "MM");
var FullDay = CurrectDay + "." + CurrectMunth;
var fulldayless = CurrectDay -1 + "." + CurrectMunth;
var dayplus = CurrectDay - 31;
Browser.msgBox(dayplus);
// check if the hour is above 00 and under 6
if (CueectHoure > 00 & CueectHoure <= 6){
//what happens if date is 1.11? we need return to 31.10
if (CurrectDay == 1){
CurrectDay = CurrectDay -1; // stuck here
} else {
}
SpreadsheetApp.getActiveSheet().getRange('n1').setValue(FullDay);
Browser.msgBox(FullDay);
}