mysql - building timezone feature in PHP web application -


This is an almost identical question for this one: -

I read That thread, and some other problems, and are not sure how to prepare timely support in PHP / MySQL applications beautifully.

I am writing an application in PHP where users can select their timezone.

Here, all timestamps have been stored in MySQL in GMT. And when presenting the data time, I am converting the timezone back into user's timezone.

Now these are the problems that I am facing: -

1) I show a list of timezones with population of MySQL's timezone tables, this is a big list and It's hard to choose from.

So, I want to apply something like windows time zone list. Offset with field info

2) PHP and MySQL can have a separate set list.

3) Where should I change the timezone in PHP or MySQL? I have a combination of coding, sometimes it is easy to choose a colored column from MySQL, sometimes it is easy to convert to PHP. So, the last point here has become very important. For example, MySQL's time_zone tables were both Asia / Kolkata and Asia / Calcutta, but at the default time of PHP 5.2.6, only Asia / Calcutta is present.

While facing this exact issue, I found that one of the ridiculous whole Unix-style timezone lists List brief, windows-style timezone for the subset.

Users are presented with a dropdown of these windows-style names (e.g., (GMT-5: 00) Eastern Time (US and Canada)), and their selection is credited to DB in Unix Is -style format (such as America / New_Org)

The user's time-zone preference is performed in PHP at the time of execution. I think I recommend it, so you can be sure that the date you are compromising in SQL / PHP, they are always living in UTC, unless they are displayed.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -