Help! My time triggers are not in sync! : How to update your Google Apps Script project time zone.

how to change your Google Apps Script project time zone

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.

Google Apps Script manifest file
Click to Expand!

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.

Google Apps Script time zone in manifest file
Click to Expand!

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:

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.

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:

GMT Converter

I hope this saves you a little time.

 

~Yagi

 

One thought on “Help! My time triggers are not in sync! : How to update your Google Apps Script project time zone.”

Leave a Reply