2

The schedule library allows you to schedule jobs at specific times of the day. For example:

schedule.every().day.at("10:30").do(job)

However its documentation doesn't mention the time reference it uses.

Is it based on UTC time?

Or is it based on the time zone of the server that runs my python script?

Fabian
  • 229
  • 3
  • 8
  • 4
    Rule of thumb is that libraries use whatever time your machine is configured to be using. – rdas Sep 24 '22 at 15:41
  • If you need a scheduler library, which allows you to easily control the time zones of the scheduler and the jobs, then have a look at this question https://stackoverflow.com/questions/47356453/python-schedule-jobs-with-different-timezones – jpotyka Sep 27 '22 at 08:22

1 Answers1

3

If you look at the code of the library, you will find that the function datetime.datetime.now() is used (here fore example).

When looking at the now documentation, you will see that without argument, it is the local time that it is used.

Thus, schedule.every().day.at("10:30").do(job) will use the server time zone.

ndclt
  • 2,590
  • 2
  • 12
  • 26