Date, Time, and Timezones in PHP
I am trying to get my head around timezones in PHP. I understand there are
functions for setting/getting timezones. But what I do not understand is
how to make things work. I am sure my understanding is wrong.
First off, the assumptions.
The server that hosts the website is set to the EST time zone.
Let's assume that there is a page that has a date associated with it.
Let's assume the time is 16:00 on this page.
A person is trying to read the page, in which date/time should be
displayed to him/her. That person is located Turkey, and therefore the
date on the webpage for this person should be 23:00.
Another person, who is in the UK is trying to view the page, so the date
for him should be displayed as 20:00
A third person, in Seattle should see the date of the page as 13:00
Now, to my questions:
How should I save the dates? Should I consider timezones when I save the
dates? What is the common practice?
How do I display local time for each person who views the page in a
different location in the world?
If I save the date of the page to a database, should I worry about the
MySQL date/time? What is a common practice for syncing PHP and MySQL
dates/times?
Thanks.
No comments:
Post a Comment