• <bdo id='RqAJa'></bdo><ul id='RqAJa'></ul>
    <tfoot id='RqAJa'></tfoot>
    <i id='RqAJa'><tr id='RqAJa'><dt id='RqAJa'><q id='RqAJa'><span id='RqAJa'><b id='RqAJa'><form id='RqAJa'><ins id='RqAJa'></ins><ul id='RqAJa'></ul><sub id='RqAJa'></sub></form><legend id='RqAJa'></legend><bdo id='RqAJa'><pre id='RqAJa'><center id='RqAJa'></center></pre></bdo></b><th id='RqAJa'></th></span></q></dt></tr></i><div id='RqAJa'><tfoot id='RqAJa'></tfoot><dl id='RqAJa'><fieldset id='RqAJa'></fieldset></dl></div>

      <legend id='RqAJa'><style id='RqAJa'><dir id='RqAJa'><q id='RqAJa'></q></dir></style></legend>
      1. <small id='RqAJa'></small><noframes id='RqAJa'>

        如何在 JavaScript 中获取时区名称?

        时间:2023-06-14

            <tbody id='ipuzA'></tbody>
          <legend id='ipuzA'><style id='ipuzA'><dir id='ipuzA'><q id='ipuzA'></q></dir></style></legend>

          1. <tfoot id='ipuzA'></tfoot>
            <i id='ipuzA'><tr id='ipuzA'><dt id='ipuzA'><q id='ipuzA'><span id='ipuzA'><b id='ipuzA'><form id='ipuzA'><ins id='ipuzA'></ins><ul id='ipuzA'></ul><sub id='ipuzA'></sub></form><legend id='ipuzA'></legend><bdo id='ipuzA'><pre id='ipuzA'><center id='ipuzA'></center></pre></bdo></b><th id='ipuzA'></th></span></q></dt></tr></i><div id='ipuzA'><tfoot id='ipuzA'></tfoot><dl id='ipuzA'><fieldset id='ipuzA'></fieldset></dl></div>
              <bdo id='ipuzA'></bdo><ul id='ipuzA'></ul>
              • <small id='ipuzA'></small><noframes id='ipuzA'>

                  本文介绍了如何在 JavaScript 中获取时区名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道如何获取时区偏移量,但我需要的是能够检测美国/纽约"之类的内容.这甚至可以通过 JavaScript 实现,还是我必须根据偏移量来猜测?

                  I know how to get the timezone offset, but what I need is the ability to detect something like "America/New York." Is that even possible from JavaScript or is that something I am going to have to guestimate based on the offset?

                  推荐答案

                  国际化 API 支持获取用户时区,支持在所有当前的浏览器中.

                  The Internationalization API supports getting the user timezone, and is supported in all current browsers.

                  console.log(Intl.DateTimeFormat().resolvedOptions().timeZone)

                  请记住,在一些支持国际化 API 的旧浏览器版本上,timeZone 属性设置为 undefined 而不是用户的时区字符串.据我所知,在撰写本文时(2017 年 7 月)除 IE11 之外的所有当前浏览器 都会将用户时区作为字符串返回.

                  Keep in mind that on some older browser versions that support the Internationalization API, the timeZone property is set to undefined rather than the user’s timezone string. As best as I can tell, at the time of writing (July 2017) all current browsers except for IE11 will return the user timezone as a string.

                  这篇关于如何在 JavaScript 中获取时区名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 Nodejs 中使用时区偏移? 下一篇:使用 JavaScript 检测时区缩写

                  相关文章

                  <i id='9ffLD'><tr id='9ffLD'><dt id='9ffLD'><q id='9ffLD'><span id='9ffLD'><b id='9ffLD'><form id='9ffLD'><ins id='9ffLD'></ins><ul id='9ffLD'></ul><sub id='9ffLD'></sub></form><legend id='9ffLD'></legend><bdo id='9ffLD'><pre id='9ffLD'><center id='9ffLD'></center></pre></bdo></b><th id='9ffLD'></th></span></q></dt></tr></i><div id='9ffLD'><tfoot id='9ffLD'></tfoot><dl id='9ffLD'><fieldset id='9ffLD'></fieldset></dl></div>

                    <small id='9ffLD'></small><noframes id='9ffLD'>

                    <tfoot id='9ffLD'></tfoot>

                      <legend id='9ffLD'><style id='9ffLD'><dir id='9ffLD'><q id='9ffLD'></q></dir></style></legend>
                        <bdo id='9ffLD'></bdo><ul id='9ffLD'></ul>