Skip to main content
Inspiring
January 21, 2022
Question

Timing of Scheduled Tasks when server and client timezones both change

  • January 21, 2022
  • 2 replies
  • 430 views

Hello,

My client lives in Sydney and wants scheduled tasks to run every hour throughout their workday.

The server is hosted in Central Time USA.

Both locations go through timezone changes twice a year.

I can set the JVM locale to be Sydney, making the setting of the time to run scheduled tasks straight-forward.

When the server's clock changes, that will affect its execution time, right?

 

Thank you
Brent

[Edited by moderator.]

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
January 30, 2022

Was my suggestion useful? If not, we can look into it further. It looks like a handy use-case that developers will likely encounter.

Inspiring
February 3, 2022

Your suggestion is appreciated yet not something I've been able to implement.

 

If there is another field in the scheduled task screen which lets the admin set the timezone in which it executes that would be helpful.

 

Thank you for suggesting

Brent

BKBK
Community Expert
Community Expert
February 4, 2022

If there is another field in the scheduled task screen which lets the admin set the timezone in which it executes that would be helpful.


By @brents78709329

 

There is no such setting. Well, none that I am aware of.

 

In any case, you said earlier:

My client lives in Sydney and wants scheduled tasks to run every hour throughout their workday.


By @brents78709329

So, you could just:

  1.  Configure your server with local settings: Central Time USA, locale=en_US or English (US), and so on.
  2.  Configure the scheduled task to run every hour. That's it. 
         Though Sydney_Time = CT_Time + 17 hours, an hourly frequency is the same everywhere. 🙂

 

BKBK
Community Expert
Community Expert
January 23, 2022

Yes, when the server's clock changes, that will affect execution times. For that reason, I would solve the problem as follows:

  1.  Make sure the server is configured with local settings. That is, with an appropriate locale in the US and with Central Time USA.
  2. Write a function to convert from local-datetime-in-Sydney to local-datetime-in-Central-Time. That is, the function determines what time it is in the Central Time USA timezone for a given local-datetime-in-Sydney.
  3.  Use the function to convert each scheduled task start-time, stSydney (a local time in Sydney), into a server-local time, stCentral.
  4.  Configure the scheduled task to start at times stCentral.