Question: Usage of timezone field in CrontabSchedule #641
-
Summary:Include a brief description of the problem here, and fill out the version info below.
Exact steps to reproduce the issue:By doing something like this, assuming the server is running in UTC : schedule, _ = CrontabSchedule.objects.get_or_create(
minute="30",
hour="10",
day_of_month="*",
month_of_year="*",
day_of_week="1",
timezone="Europe/Brussels",
) Detailed informationIs it correct to say that tasks with this schedule will run every Monday at 10:30 for the Europe/Brussels timezone ? (And on the server it'll run at 9:30 effectively since it is in UTC ?!) Thanks in advance 🙂 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, it is correct to say that tasks with this schedule will run every Monday at 10:30 for the Europe/Brussels timezone, and on the server, it will run at 9:30 effectively since it is in UTC. Regarding Daylight Saving Time (DST), it will be automatically taken into account by the pytz library, which is used by Celery to handle time zones. Europe/Brussels time zone observes DST, so when DST starts, the task will run at 11:30 UTC instead of 10:30 UTC, and when DST ends, the task will run at 9:30 UTC instead of 10:30 UTC. |
Beta Was this translation helpful? Give feedback.
Yes, it is correct to say that tasks with this schedule will run every Monday at 10:30 for the Europe/Brussels timezone, and on the server, it will run at 9:30 effectively since it is in UTC.
Regarding Daylight Saving Time (DST), it will be automatically taken into account by the pytz library, which is used by Celery to handle time zones. Europe/Brussels time zone observes DST, so when DST starts, the task will run at 11:30 UTC instead of 10:30 UTC, and when DST ends, the task will run at 9:30 UTC instead of 10:30 UTC.