Determine a user's timezone

前端 未结 25 2879
刺人心
刺人心 2020-11-21 07:12

Is there a standard way for a web server to be able to determine a user\'s timezone within a web page?

Perhaps from an HTTP header or part of the user-agent

相关标签:
25条回答
  • 2020-11-21 07:45

    Here is a robust JavaScript solution to determine the time zone the browser is in.

    >>> var timezone = jstz.determine();
    >>> timezone.name(); 
    "Europe/London"
    

    https://github.com/pellepim/jstimezonedetect

    0 讨论(0)
提交回复
热议问题