I have a problem with Google Script. I am trying to calculate all dates of a week. I have the Monday Value in a sheet and copy it to an array and then declare it as a variable. I can afterwards format it and extract the week, the year and so on.
However, if I want to add one day for Tuesday he is giving me the Monday Date and adding a 1 at the end.
I am using the following code:
var StartDatum = Data [5][7]
var Week = Utilities.formatDate(StartDatum, "GMT", "ww")-1;
var Month =Utilities.formatDate(StartDatum, "GMT", "MM");
for (var i=14; i < 21; i++){
var Datum = ((StartDatum + (i - 14)));
}
For StartDatum I receive a proper date:
Mon Jan 13 2020 09:00:00 GMT+0100 (CET)
Week and Month also work.
But for Datum I receive:
Mon Jan 13 2020 09:00:00 GMT+0100 (CET)0
Mon Jan 13 2020 09:00:00 GMT+0100 (CET)1
Mon Jan 13 2020 09:00:00 GMT+0100 (CET)2
Mon Jan 13 2020 09:00:00 GMT+0100 (CET)3
... and so one.
Could somebody please give me a hint about my mistake