how do you deal with timezone issues? [duplicate]

限于喜欢 提交于 2020-01-12 15:16:28

问题


For a scheduling system, what's the best way to save the timezone of client/event in a central server database coming from multiple sources mobile,web,client app.

  • How do you store the dates? Alarms, reminders etc...
  • How do you handle the DST setting?
  • How do you handle the events if client has traveled to a different location?

I need the solution to work with all databases in tags.


回答1:


These are the key points to the strategy I tend to use.

  • Every date is UTC internally to the system.
  • Users are shown dates in the their local timezone.
  • We allow users to override the timezone they are using in case they travel and they want to keep the timezone consistent.
  • Make the timezone easily visible. Either display it with the time or as part of the column header.



回答2:


Everything in UTC, and another column for the offset.




回答3:


Store dates as UTC timestamps - convert to local time when displaying data to the user.




回答4:


  1. Safe to store in one specific time zone ideally in UTC
  2. If you store the time with a date, you are safe in DST.
  3. Suggesting you to use a web service to find the time difference.


来源:https://stackoverflow.com/questions/2148237/how-do-you-deal-with-timezone-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!