Skip to content
Advertisement

Google Apps Script returns wrong timezone

My google Apps Script script returned a wrong timezone with Date(). What I expect is GMT+8 (because I live in Asia) but the script timezone returns GMT-5. Even the log time is not match.

Code:

let date = new Date(); 
Logger.log(date);

enter image description here How can I change it from GMT-5 to GMT+8? Any help would be highly appreciated!

enter image description here

Advertisement

Answer

You can change the timezone of your script by modifying the manifest file.

This can be done by going to Project Settings and ticking the Show “appsscript.json” manifest file in editor.

enter image description here

Afterwards, just update the manifest file to this:

{
  "timeZone": "Asia/Taipei",
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}

Note

Please bear in mind that you can modify this and input the timezone of your choice.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement