How does Laravel scheduler handles daylight saving time?

Viewed 944

Currently I'm scheduling jobs to be executed at 2AM ->dailyAt('02:00');.

I'm wondering what will happen if:

  • DST ends: will the jobs execute twice, as 3AM becomes 2AM?
  • DST begins: 2AM becomes 3AM, will the jobs then not be executed?
2 Answers

Scheduler does not hadle DST so if you run it at 02:00 one night it won't be executed at all and second night it would be executed twice.

I would recommend you to schedule it outside to the 'DST Changing zone' for example at 1:59

This issue is open on https://github.com/laravel/docs/issues/3198

Well if you use UTC time this problem goes away entirely. UTC doesn't get affected by time zones. Its good practice to use/set the timezone to UTC on the server and convert as needed.

Related