Cron jobs & timezone conversions in PHP

Scheduling

The problem

After some debugging, I figured out what was going on. The server the application is running on has the timezone configured as UTC and the user reporting the bug was located in New York, America.

0 13 * * *

The solution

The solution is fairly simple, “just” convert the hour part of the cron job from the timezone of the user configuring it to UTC. My first attempt was a little bit too straight forward:

- 0 13 * * *
- * * * * *
- * */2 * * *

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store