Working with time zones in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spudse
    New Member
    • Jan 2008
    • 11

    Working with time zones in php

    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.
  • spudse
    New Member
    • Jan 2008
    • 11

    #2
    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?

    Comment

    Working...