I have a web application that allows users to select to have a certain operation performed at a specific hour on a specific weekday (ex: 7pm Friday) -- recurring every weekday. My users are located in different timezones. Therefore I would like to store the day/hour in one time zone format so that my cron job which runs hourly can query my database and quickly grab all the rows that represent tasks to be performed that hour. What's the best way to accomplish this?
Basically I need to know how to take Friday 7:00pm in Boston, MA or Saturday 3:00pm San Francisco, CA and convert both to GMT (and store in my DB). That way when I run my cron job once an hour I know exactly what value to query the database for given what GMT day/hour it currently is.
EDIT 1 Through playing around I came up with something:
date_default_timezone_set('America/New_York');
$time = strtotime('Friday 8:00pm');
echo date('w : G', $time);
echo '<br>';
date_default_timezone_set('GMT');
$date = date('w : G', $time);
echo $time;
echo '<br>';
echo $date;
The output is:
5 : 20
1331942400
6 : 0
Is this basically the right track?
EDIT 2 Useful detail, I'm actually lucky enough to have my user's timezone information stored as one of these: http://www.php.net/manual/en/timezones.php