Search code examples
phpmysqltimetimezoneelapsed

Time Elapsed and Timezones


my problem is as following : When I store a DateTime and then retrieve it and do some elapsed function to know how much time ago I stored that DateTime, I get an offset of about 7200 second, wich is 2 hours off. Im in france, so I guess its somthing like GMT +2 (+1 hour +1 summer hour).

How can I fix this? there is somthing to do with set/get timezone but im not sure how exactly to do it Thanks for any help

I use php5.3; mysql 5.05


Solution

  • in php you can use: date_default_timezone_set ( string $timezone_identifier ) to set timezoen

    http://php.net/manual/en/function.date-default-timezone-set.php

    in mysql, take a look at: http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html