How to elegantly deal with timezones

后端 未结 7 537
庸人自扰
庸人自扰 2020-11-28 17:31

I have a website that is hosted in a different timezone than the users using the application. In addition to this, users can have a specific timezone. I was wondering how ot

7条回答
  •  情话喂你
    2020-11-28 18:26

    This is just my opinion, I think that MVC application should separate well data presentation problem from data model management. A database can store data in local server time but it's a duty of the presentation layer to render datetime using local user timezone. This seems to me the same problem as I18N and number format for different countries. In your case, your application should detect the Culture and timezone of the user and change the View showing different text, number and datime presentation, but the stored data can have the same format.

提交回复
热议问题