• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Timing of Scheduled Tasks when server and client timezones both change

Community Beginner ,
Jan 21, 2022 Jan 21, 2022

Copy link to clipboard

Copied

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.]

TOPICS
Advanced techniques

Views

178

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 23, 2022 Jan 23, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2022 Jan 30, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 03, 2022 Feb 03, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2022 Feb 04, 2022

Copy link to clipboard

Copied

LATEST

 

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation