Displaying time and timezone information to the user (what, not how)

后端 未结 13 1665
予麋鹿
予麋鹿 2020-12-31 17:13

(This is a question about the UI rather than the technology required to do it)

What is the clearest way to display a time for events occurring in different timezones

13条回答
  •  旧时难觅i
    2020-12-31 18:07

    Having been bitten several times over the years by "small" applications suddenly being either nationwide (in the US, 5 or 6 timezones) or global, I always store datetime data in UTC if possible.

    The problem then becomes display, as a number of other post have pointed out.

    If a date/time is displayed, and it relates to the location (and locale) of the current user, display it in the user's local time.

    If multiple date/times are to be displayed and they relate to different locations (possibly different locales), I've found that the users prefer to see the time displayed in the location's timezone, in 12 hour format.

    Think about how airline tickets are printed (at least in the US) - departure and arrival times are displayed in the timezone of the departure city and arrival city. The best itineraries have a "total travel time" or the duration displayed as well.

    Ok, so you want to show locale formatted data for the user: How do you determine the locale? For web applications, while locale is present in most HTTP headers, you can't always trust that the locale is set correctly on the user's machine. So we almost always end up either asking the user to set up a profile that includes some data from which we can determine locale (zip/postal code, city/state/country, etc) or to enter something that gives us an idea of where the user actually resides (for either Web apps or 'native' applications)

    I have not had to implement this since geo-location via ip address became widely available, but that is not necessarily accurate either.

    Note that when I've worked on these applications, my personal settings almost always end up in 24 hour format, UTC, ISO8601 just so I know what time is being displayed to me, regardless of where the user is.

提交回复
热议问题