If you have made it to this post you are probably a little frustrates 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:
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:
Or in your code, like this:
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.
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.
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:
And a link to the GMT converter:
I hope this saves you a little time.