Reputation: 1759
Is it really necessary to allow the user to pick from any timezone returned by PHP's timezone_identifiers_list()? There are a tremendous amount of timezones, and that HTML dropdown menu is pretty laggy on some systems due to how many options there are. I understand that I can generate common US timezones by hand such as Pacific, Eastern, Central, etc.. but is there a list of commonly-used international timezones? By common, I mean where if I were to use that list, then it would capture 99.9% of my international user base. It just seems like overkill to have to include EVERY possible timezone as an option to the user. Does anyone have ideas on best practices for timezones in general?
Upvotes: 0
Views: 152
Reputation: 53774
Is it really necessary to allow the user to pick from any timezone returned by PHP's timezone_identifiers_list()?
No why should users have to bother with that? One practice for dealing with different timezones is to store everything as unix timestamps in the database. Then when you are displaying it use a bit of javascript to convert it into the user's timezone dependent date and time.
Upvotes: 1
Reputation: 4716
if I were to use that list, then it would capture 99.9% of my international user base
Do you know where 99.9% of your international user base is from? Then you can assemble this list yourself.
Or you could suggest a timezone based on other information, such as a user's city or country. You could try to use GeoIP to determine his location (beware of proxies though).
Split the list into two lists (continent and location), preselect them based on the suggestion.
Upvotes: 0
Reputation: 1866
You can do it in a lot of different ways.
The one I would say works out the best is just us the PHP's timezone_identifiers_list()
.
But instead of making a dropdown list, make two dropdowns.
And then you should makethe dropdown with the cities a searchable field, so a person can write some of the cityname and it only shows the cities including what the person has written. (as @dam660 suggested Chosen is a good choice here)
This way you would cover all the timezones and it wouldn't be a total mess to look at.
Upvotes: 1