you should probably use
@strtotime
(same function but silences errors)
it's kind of a buggy function but invaluable for what it does.
Main Topics
Browse All TopicsI have times stored in a database like "9:30 am" or "10:00 pm" and I am trying to convert these times to GMT (I have the offset stored in a table) but am unsure of how I can convert these in PHP.
So I may have a time stored as "10:00 pm" stored in the database and the user is EST so I want to convert that time to GMT then take the GMT time of the meeting and add the offset of the user so that it returns a time in a smilar format.
So if I have a time in the database for a user stored as 11:00 am and for that user they are EST. They have a meeting with someone who is CST, I am trying to reach the outcome of their local time so that when they receive the email it has the time local to them.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Came up with my own solution not long after I posted my question but it works good.
$time = '11:00 am';
//Convert time to GMT
$originalOffset = str_replace("-", "+", "-5") . " hours";
$gmtTime = strtotime($originalOffset,
$gmtTime = strftime( "%I:%M %p",$gmtTime);
//Convert time to users time
$usersOffset = '-6 hours';
$prospectTime = strtotime($usersOffset, strtotime($gmtTime));
$prospectTime = strftime( "%I:%M %p",$prospectTime);
echo 'GMT: ' . $gmtTime . '<br/>Appointment for user: ' . $time . '<br>For prospect: ' . strtolower($prospectTime);
Business Accounts
Answer for Membership
by: Michael701Posted on 2007-06-27 at 09:54:32ID: 19374022
just use strtotime() to convert the database time to a unix timestamp and then add the GMT offset
as a hint, you might find it easier to store ALL times in the database in GMT. this way you'd only have one conversion (to the client's timezone) when you have to display a meeting.
Michael