I am not sure how to do this could somebody stir me in the right direction. I have a program that is set up to store appointments for customers all over the united states. The server holding the program is in the Pacific Time Zone. In the program the customers set there time zone so I know were they are at. I have customers in Hawaii and also in New York. I am trying to wright a script that sends out reminders to the different customers at different times set by them. The problem I am having is figuring out how to calculate the proper time to send the reminder so they will get it at the proper time like 2pm New York time or Hawaii time or other time zones. So if it is sent by the program which is in pacific time zone to arrive at 2pm and it is being sent to somebody that is in New York to get to them on time it needs to be sent from the server time at 11am.
I have read the manual all about timezone and searched Google but I am not sure what to do
Time Zone Question
I don't know if your DBMS has a date/time type that includes timezones, but it may be simpler to store all dates and times using the same zone (UTC is the definitive choice), so that it becomes easy to tell what time something should be sent (because something that should be sent at 14:00 UTC would be recorded in the database as something that should be sent at 14:00 UTC).
I would also opt for using UTC. So the user living in New York would be labeled as UTC -0400, the one living i Hawaii as UTC -1000, etc.
If the clients are scheduling these reminders by accessing your website using a browser, I believe you could rely on Javascript to transform the time they choose into UTC. If that is the case, you might construct your reminder-creation form to use Javascript to translate their selected time into UTC and just store the UTC time directly on your server. I believe this would require your users to have properly set time and timezone on their computer. You should check out https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
NOTE: It's tricky in Javascript to try and calculate time zone offsets. Just use it to translate a user's local time to UTC.
If you can't rely on Javascript helping you out, then you are going to need to know the date, time, and TIMEZONE where the customer wants their notification. Ideally, you'd have them choose one of the PHP timezones:
http://www.php.net/manual/en/timezones.php
If you know which of those timezones applied to a user, your server can take a Date, Hour, Minute, and Time of day to construct a UTC DateTime.