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 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:


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.


Create and Publish a Google Workspace Add-on with Apps Script Course

 

Looking to learn more about Google Apps Scripts in a more structured format? Udemy has some great courses that can get you from the basics to a real Google Apps Script pro.

Got a more specific problem you need help with, but don’t have the time to develop the skills? Make an enquiry on my 'Hire me!' page. I occasionally pick up projects. Alternatively, Fiverr’s your best bet to find a skilled Google Apps Script developer to solve your problem quickly and professionally. *

*The above affiliate links have been carefully researched to get you to what you specifically need. If you decide to click on one of these links it will cost you just the same as going to the site. If you decide to sign up, I just get a little pocket money to help pay for the costs of running this website.

~Yagi

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

  1. 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 πŸ™‚

Leave a Reply

%d bloggers like this: