TimeZones in Java

后端 未结 9 1322
执念已碎
执念已碎 2020-12-03 07:19

I am allowing users on my web app to schedule events based on time zones of their choice.

I want to present a good list of time zones to the end user and then conver

相关标签:
9条回答
  • 2020-12-03 07:50

    You can reduce the list with TZ IDs which match only the following regexp

    ^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*
    
    0 讨论(0)
  • 2020-12-03 07:50

    If you need the granularity of choosing exactly how the list would look, I would use the best hard-coded list I could find (this is a good example) and ensure it is displayed and converted as precisely as possible.

    Just keep in mind that each one of those 585 time zones does have a semantic meaning (such as DST for example) and users might want to choose the best time zone for them. Although I do agree that list can be much shorter.

    0 讨论(0)
  • 2020-12-03 07:51

    With that many, I wouldn't try to shoehorn them into a select box list.... I'd put them on a list in a separate modal dialog (or popup, if you must), let the user scroll through and click the name they want. They would click on a link in the modal dialog, and it would populate a text field with the correct code, and you could then submit that to your server.

    Better yet, have them click their location on a map of the world, and use an image map to translate that location to the appropriate time zone.

    0 讨论(0)
提交回复
热议问题