How can I handle time zones in my webapp?

前端 未结 7 1045
囚心锁ツ
囚心锁ツ 2020-11-30 16:16

I\'m looking for better understanding of the following user story:

John works in Sidney. At 9:00 in the morning, he logs an event in a web app that runs on a server

7条回答
  •  鱼传尺愫
    2020-11-30 17:06

    For that particular case I would store both local and UTC time. UTC is a somewhat major and used for sync and convertion of time to current time zone. Local is used for searches and for additional info, like:

    You have a meeting:

    12:00 Monday (UTC)
    9:00 Monday (Sydney, creation local time)
    11:00 Monday (Zurich, local time)
    

    or something like that. The other way is to store creation time zone, and convert at runtime (this is particularly better in case then user will change meeting time). Either way the main reason is to be able to restore original creation time so user can refer to it.

提交回复
热议问题