Time zones and Localisation

后端 未结 5 1388
轻奢々
轻奢々 2021-01-16 06:27

I\'m currently storing all times in UTC, to make things easier for when I start bringing multiple sites and servers online.

The problem comes in when translating

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-16 07:19

    You can't reliably get a user's timezone from the request headers. That's why most website ask users to set their timezone in profile settings. However, you can use various tricks to try to get. One trick is to use Google's IP-to-location api to find out where the user is coming from and then try to guess the timezone from the geo location. This is not 100% reliable either, but will get you closer to the truth.

    just realized this has already been asked here at least once: get user timezone

提交回复
热议问题