• <legend id='8oRyI'><style id='8oRyI'><dir id='8oRyI'><q id='8oRyI'></q></dir></style></legend>

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

      1. <tfoot id='8oRyI'></tfoot>
          <bdo id='8oRyI'></bdo><ul id='8oRyI'></ul>

        在Javascript中获取时区的UTC偏移量

        Get utc offset from timezone in Javascript(在Javascript中获取时区的UTC偏移量)

            <tbody id='YCiHO'></tbody>

          • <legend id='YCiHO'><style id='YCiHO'><dir id='YCiHO'><q id='YCiHO'></q></dir></style></legend>

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

              <bdo id='YCiHO'></bdo><ul id='YCiHO'></ul>
                  <i id='YCiHO'><tr id='YCiHO'><dt id='YCiHO'><q id='YCiHO'><span id='YCiHO'><b id='YCiHO'><form id='YCiHO'><ins id='YCiHO'></ins><ul id='YCiHO'></ul><sub id='YCiHO'></sub></form><legend id='YCiHO'></legend><bdo id='YCiHO'><pre id='YCiHO'><center id='YCiHO'></center></pre></bdo></b><th id='YCiHO'></th></span></q></dt></tr></i><div id='YCiHO'><tfoot id='YCiHO'></tfoot><dl id='YCiHO'><fieldset id='YCiHO'></fieldset></dl></div>
                1. <tfoot id='YCiHO'></tfoot>
                2. 本文介绍了在Javascript中获取时区的UTC偏移量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要一个给定时区的 Javascript 函数,返回当前的 utc 偏移量.

                  I need a Javascript function that given a timezone, returns the current utc offset.

                  例如,theFuncIneed('US/Eastern') -> 240

                  For example, theFuncIneed('US/Eastern') -> 240

                  有什么想法吗?

                  谢谢

                  推荐答案

                  一般来说,这是不可能的.

                  • US/Eastern时区的标识符.(它实际上是 America/New_York 的别名,是真正的标识符.)

                  • US/Eastern is an identifier for a time zone. (It's actually an alias to America/New_York, which is the real identifier.)

                  240 是一个时区偏移量.它通常写成 -04:00(反转符号,除以 60).

                  240 is a time zone offset. It's more commonly written as -04:00 (Invert the sign, divide by 60).

                  美国东部时区由东部标准时间和东部夏令时间组成,东部标准时间具有 -05:00 的偏移量,东部夏令时间具有-04 的偏移量:00.

                  The US Eastern Time Zone is comprised of both Eastern Standard Time, which has the offset of -05:00 and Eastern Daylight Time, which has the offset of -04:00.

                  所以说 US/Eastern = 240 一点也不准确.请阅读 timezone 标签wiki,尤其是标题为Time Zone != Offset"的部分.

                  So it is not at all accurate to say US/Eastern = 240. Please read the timezone tag wiki, especially the section titled "Time Zone != Offset".

                  现在您确实要求 当前 偏移量,这 可能的.如果您提供日期+时间参考,则可以解决此问题.

                  Now you did ask for the current offset, which is possible. If you supply a date+time reference, then you can resolve this.

                  • 对于执行 javascript 代码的计算机的本地时区,这是使用 .getTimeZoneOffset() 内置于任何 Date 实例的对象.

                  • For the local time zone of the computer where the javascript code is executing, this is built in with .getTimeZoneOffset() from any instance of a Date object.

                  但如果您希望它用于特定时区,那么您将需要使用 我在此处列出的库之一.

                  But if you want it for a specific time zone, then you will need to use one of the libraries I listed here.

                  这篇关于在Javascript中获取时区的UTC偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                  Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                  Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                  Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                  Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                  How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)

                    <tbody id='PAWLt'></tbody>

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

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

                      • <tfoot id='PAWLt'></tfoot><legend id='PAWLt'><style id='PAWLt'><dir id='PAWLt'><q id='PAWLt'></q></dir></style></legend>
                          <bdo id='PAWLt'></bdo><ul id='PAWLt'></ul>