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.
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.
Comment