I'm trying to run a .php
script on at 12 am (midnight) for every timezone.
My goal: I have a field in my database called time_zone
. i need to send an email to that user in that "time zone" at 12 am.
i looked into cron jobs but i don't think it works well with timezones. is there any other way to achieve this?
EDIT: I did think about running the script every 30 min because some timezones are 30 min apart but that doesn't seem like a good solution because i wouldn't know how to calculate in which time zone it is 12:00 am.
You could make an array of all time-zones and compare from that. If that exists in the array you can send the email. It's not perfect, but it should do the job.