If you have made it to this post you are probably a little frustrated about why your Google Apps Script time triggers are not running on or around the times that you have designated. Of course, you could simply just be a well-oiled machine and want to know how to update the time zone of your project for your client.
To cut to the chase, the likely cause of clock triggers not running in the time range that you have selected is that the time zone in your Google Apps Script project is out.
How to check your Project’s Timezone
So, how do you check the time zone of your project?
If you need to do it programmatically you can use the Session class and the getScirptTimezone()
method. Something like this will log your project’s timezone:
1 |
console.log(Session.getScriptTimeZone()) |
Alternatively, you can check out your project manifest file.
To do this in your Google Apps Script IDE, go to your sidebar and select the Project settings cog and then check the Show “appsscript.json” manifest file in editor checkbox under the general settings.
Go back to the editor and your “appscript.json” file will be visible. Select it and you will be able to see the current time zone for your project.
Changing the timezone
So, at the time of writing this, I found the information on the correct syntax for the time zone in the manifest in the docs either too simplified or when clicking the associated link, too convoluted for my poor goat brain to handle.
In short, you can add certain countries followed by their city. Like this:
“Australia/Sydney”
Or in your code, like this:
1 2 3 4 5 6 7 |
{ "timeZone": "Australia/Sydney", "dependencies": { }, "exceptionLogging": "STACKDRIVER", "runtimeVersion": "V8" } |
Alternatively, you can use GMT time in this format:
“Etc/GMT-10” << For Sydney, Australia
The -10 can be changed to whatever GMT you need.
Resources
After a bit of testing and some searching, I came across these two resources to help you when entering in the correct time zone.
- http://joda-time.sourceforge.net/timezones.html <<Note! It is not HTTPS secure.
- http://tutorials.jenkov.com/java-date-time/java-util-timezone.html
Alternatively, I have created a Google Sheet that contains:
- A full timezone list with aliases
- A full timezone list without aliases
- A GMT only list
These might be useful for bookmarking or exporting certain Google Sheet tabs as CSVs.
Just go to File > Make a copy so you have your very own version of the document.
Finally, here is a list of all the GMT values:
Standard Offset | GMT |
---|---|
-12:00:00 | Etc/GMT+12 |
-11:00:00 | Etc/GMT+11 |
-10:00:00 | Etc/GMT+10 |
-09:00:00 | Etc/GMT+9 |
-08:00:00 | Etc/GMT+8 |
-07:00:00 | Etc/GMT+7 |
-06:00:00 | Etc/GMT+6 |
-05:00:00 | Etc/GMT+5 |
-04:00:00 | Etc/GMT+4 |
-03:00:00 | Etc/GMT+3 |
-02:00:00 | Etc/GMT+2 |
-01:00:00 | Etc/GMT+1 |
+00:00:00 | Etc/GMT-0 |
+01:00:00 | Etc/GMT-1 |
+02:00:00 | Etc/GMT-2 |
+03:00:00 | Etc/GMT-3 |
+04:00:00 | Etc/GMT-4 |
+05:00:00 | Etc/GMT-5 |
+06:00:00 | Etc/GMT-6 |
+07:00:00 | Etc/GMT-7 |
+08:00:00 | Etc/GMT-8 |
+09:00:00 | Etc/GMT-9 |
+10:00:00 | Etc/GMT-10 |
+11:00:00 | Etc/GMT-11 |
+12:00:00 | Etc/GMT-12 |
+13:00:00 | Etc/GMT-13 |
+14:00:00 | Etc/GMT-14 |
And a link to the GMT converter:
I hope this saves you a little time.
Need help with Google Workspace development?
Go something to solve bigger than Chat GPT?
I can help you with all of your Google Workspace development needs, from custom app development to integrations and security. I have a proven track record of success in helping businesses of all sizes get the most out of Google Workspace.
Schedule a free consultation today to discuss your needs and get started or learn more about our services here.
~Yagi
Thank you!!! I spent 8 hours getting crazy before finding your tip on how to change the timezone in Google Apps scripts. You saved my day 🙂
You are very welcome!