Re: Dates and different time zones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Niklas Karlsson wrote:

I am creating an international site that is going to get used in both
American and Europe. And I wonder how to handle the different time zones,
because I want the date and time to be correct after the place your using
the application.

I now have the date_default_timezone_set() to "Europe/Stockholm", and all
dates that is saved into the database is timestamp with time zone (using
PostgreSQL).

So a wonder who to handle different time zones? Have any of your experience
of this?

Store all of your dates as GMT. Perform all date based calculations around GMT also, and then offset the values for localised display only.

This way you only need to store the GMT offsets for each user, i.e. GMT+1 or GMT-8 when it comes to displaying the dates to them. The trick is to use a constant base date for all data, and only being the user timezones into play when needed.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux