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);
How can I change it from GMT-5 to GMT+8? Any help would be highly appreciated!
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.
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.