How to show a UTC time as local time in a webpage?

后端 未结 5 1685
长发绾君心
长发绾君心 2020-12-14 03:32

I have a database that holds a time as UTC. This time can be shown in a webpage, so I’ve been asked to show it as local time in the page as it can be viewed from any country

5条回答
  •  旧巷少年郎
    2020-12-14 03:57

    Of-course is possible. You just need to find that country settings to detect the country your user comes from, and then modify the displayed date to fit that country's time.You can also find another way to detect the user country.(maybe from his ip address).

    I am sure that the best way to manage this is let your colleague know that you need more details about the country settings implementation on your project and how can you use it.

提交回复
热议问题