I want to extract a date from a spreadsheet that is in a "DD dd/mm/yyyy hh:mm:ss" format and put it in another spreadsheet and afterwards create an event in calendar, the problem is that when it is extracted it gets a different time zone than the one from the original spreadsheet, and it changes with different documents. The Utilities.formatDate() command doesn't work for me because it appears in the correct time zone.
Cell value : mon. 02/04/2018 12:00:00
Original Spreadsheet time zone : GMT -800
New Spreadsheet time zone : GMT -800 (also)
function Event(){
var firstdoc =SpreadsheetApp.openById("ID"); // ouvre le fichier manifest list
var firstdocsheet = firstdoc.getSheetByName("sheet");
var date1= new Date(firstdocsheet.getRange(4,10).getValue());
Logger.log(date1);
date1 = Utilities.formatDate(date1, "GMT-800", "dd-MM-yyyy HH:mm:ss");
Logger.log(date1);
}
This is what I get:
Logger.log([Mon Apr 02 21:00:00 GMT+02:00 2018)
Logger.log([02-04-2018 11:00:00)
I know that the code works but I don't get why it takes the wrong date since the beggining, any help please ?
GMT-08:00
? – Casper