I have a Google App script that reads a row with two dates from a Spreadsheet.
The two dates are read with different timezones and I do not understand why.
Cell contents are:
25/12/1941 16/02/2021
Dates are read through
var dataRng = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Elenco').getRange("G"+rowElenco+":AC"+rowElenco);
var dati = dataRng.getValues();
First date is read as
Thu Dec 25 1941 00:00:00 GMT+0200 (Central European Standard Time)
Second date is
Tue Feb 16 2021 00:00:00 GMT+0100 (Central European Standard Time)
Why the first date is GMT+"?
I (think I) have properly setup the SpreadSheet and Script timezones:
Logger.log(Session.getScriptTimeZone());
Logger.log(SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTimeZone());
outputs:
03:49:18 Informazioni Europe/Rome
03:49:18 Informazioni Europe/Rome
This is causing issues because I try to format the date and
var dtNascita = Utilities.formatDate(dati[0][11], "GMT+1", "dd/MM/yy");
becomes
dtNascita: "24/12/41"
What am I missing?