1

How to handle cron jobs for multiple timezone?

I am working on the PHP project that supports users from multiple timezones. I have used multiple cron jobs for multiple database operations.

I am setting cron job to send push notification on the date of user's birthday. For ex., I am from USA and my birthday is 1st December. It should send push notification on the bases of timezone. So if my brother is living in France, he should get notification on his 1st December, not mine.

So how to manage this kind of implementation/cron jobs?

  • Cron doesn't know where your users are. You could set up a chron job that runs every 15 minutes to notify all users that just switched dates if there are events for them for that new date. (You may get away with only checking once an hour if it is acceptable that all the timezones that have smaller offsets receive their notifications a little later.) – Hulk Nov 30 '16 at 11:02
2

cron doesn't have a notion of timezones.

That kind of manipulation would be handled from within your PHP code. Your server will only have one timezone. It is up to you to compute the differences within PHP.

-1

Use dates as timestamps to avoid timezones mess

Not the answer you're looking for? Browse other questions tagged or ask your own question.