r/GoogleAppsScript • u/VAer1 • Dec 18 '25
Question Trigger every 6 hours: How to make sure that trigger hours = 0, 6, 12, 18
How can I make sure that it is always triggered at midnight -1am /6-7 am/ 12pm-1pm/6-7 pm? While not affected by daylight saving adjustment.
Not hourly trigger, I do mean trigger setting is every 6 hours.
2
Upvotes
5
u/Log_In_Progress Dec 18 '25
why not run it every hour, and put a condition if(currentTime = 0 OR 6 OR 12 OR 18) then run ELSE quit.
3
u/dimudesigns Dec 19 '25 edited Dec 19 '25
You can create an installable trigger to fire at one of your given times. When that trigger fires, do what ever work that needs to be done, then destroy the trigger, and finally create a new trigger to fire 6 hours in the future.
Alternatively, If you want even greater precision, set up a GAS Web App as a webhook endpoint, and use an external service like cron-job.org or Google's Cloud Scheduler to send notifications at your desired interval.
2
u/tenglish25 Dec 18 '25
Other than starting the trigger at one of the cardinal times, maybe you could set 4 day based triggers that are based at those times
2
u/SubnetDad Dec 19 '25
You can’t guarantee exact wall-clock hours (0 / 6 / 12 / 18) with a single “every 6 hours” trigger. That trigger is interval-based, not clock-anchored, and it will drift with DST or if it’s recreated.
If exact times matter, the only reliable options are:
There isn’t a supported way to pin an “every N hours” trigger to specific clock hours. If the hours must be exact, multiple daily triggers are the correct approach.
1
u/WicketTheQuerent Dec 18 '25
See https://stackoverflow.com/q/72574417/1595451