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!
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"
}
Please bear in mind that you can modify this and input the timezone of your choice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.