By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Working with time zones in php

P: 11
I am creating a PHP web application where users can see which events have occured between two input dates. These events and their datetime are stored in a database in UTC timezone.

The user is able to select the time zone he is in and then the start date en end date. The PHP script then selects all events date occured between those dates.

The date values submitted by user are:
01-01-2008 00:00
05-01-2008 23:59
and these need to be converted to UTC, this conversion is ofcourse depending on the time zone that the user is in.

How would I do this? I thought about creating a database table that contains all timezones and the difference with UTC, but that neglects the fact that many countries have daylight saving time. Also I would like to do this in PHP instead of SQL.
Jan 7 '08 #1
Share this Question
Share on Google+
1 Reply

P: 11
I already found this article: Get the correct time by converting between time zones with PHP and PEAR, but it makes use of PEAR and I rather not use pear.

Does anybody know a pure php solution?
Jan 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.