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

      <small id='tQf5f'></small><noframes id='tQf5f'>

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

      1. 显示用户本地区域缩写

        时间:2023-10-11

        1. <tfoot id='6Bk72'></tfoot>
          • <bdo id='6Bk72'></bdo><ul id='6Bk72'></ul>

            <small id='6Bk72'></small><noframes id='6Bk72'>

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

                  本文介绍了显示用户本地区域缩写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我试图在格式中使用 zzz 来在字符串末尾显示时区,但发现它已被弃用.ZZZ 可以显示 -0700,但我希望它显示 PDT.

                  I was trying to use z or zz in format to display the timezone at the end of the string and found that it's deprecated. Z and ZZ work to display -0700, but instead I want it to show PDT.

                  我得到了 moment-timezone 和数据文件,但我不知道如何使用它来确定客户端的本地时区并显示如下内容:

                  I got moment-timezone and the data file, but I can't figure out how to use it to determine the client's local time zone and display something like:

                  2014-05-30T22:56:23.967 太平洋时间

                  2014-05-30T22:56:23.967 PDT

                  代替:

                  2014-05-30T22:56:23.967

                  2014-05-30T22:56:23.967

                  是否可以使用 moment-timezone 来确定 EST、CST、MST、PST 等?

                  Is it possible to use moment-timezone to determine EST, CST, MST, PST, etc?

                  推荐答案

                  从 moment-timezone 0.1.0 开始,您可以使用 格式化添加获取特定时区的缩写:

                  As of moment-timezone 0.1.0, you can use the formatting additions to get the abbreviation of a specific time zone:

                  moment().tz("America/Los_Angeles").format('z');  // PST or PDT
                  

                  从 0.5.0 版开始,您现在可以猜测用户的本地时区,当与上述技术结合使用时,您可以执行以下操作:

                  As of version 0.5.0, you can now guess the user's local time zone, which when combined with the above technique, allows you to do the following:

                  moment().tz(moment.tz.guess()).format('z');
                  

                  假设猜测正确,它将显示相关的缩写.

                  Assuming the guess was correct, it will display the associated abbreviation.

                  这篇关于显示用户本地区域缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 JS 中获取客户端时区(不是 GMT 偏移量) 下一篇:使用 moment.js 将 Utc 日期更改为本地日期

                  相关文章

                  最新文章

                • <small id='Rn0JZ'></small><noframes id='Rn0JZ'>

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