久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <small id='v8yT0'></small><noframes id='v8yT0'>

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

      如何使用 moment.js 在特定時區(qū)創(chuàng)建時間

      How to create time in a specific time zone with moment.js(如何使用 moment.js 在特定時區(qū)創(chuàng)建時間)

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

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

          <tbody id='NuDZ9'></tbody>

                <bdo id='NuDZ9'></bdo><ul id='NuDZ9'></ul>
              • <tfoot id='NuDZ9'></tfoot>
                本文介紹了如何使用 moment.js 在特定時區(qū)創(chuàng)建時間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我有這個后端,它會在設(shè)定的時區(qū)向我發(fā)送一個預(yù)先格式化的時間,但沒有關(guān)于所述時區(qū)的任何信息.字符串如下:2013-08-26 16:55:00".

                I have this backend that sends me a pre formatted time in a set time zone, but without any information for the said time zone. The strings are like: "2013-08-26 16:55:00".

                我可以用這個字符串創(chuàng)建一個新的 moment.js 實例:

                I can create a new moment.js instance with this string:

                var time = moment("2013-08-26 16:55:00") //this creates time in my tz
                

                但這只會在我自己的時區(qū)創(chuàng)建一個實例.

                but this will only create an instance in my own time zone.

                Moment.js 有一個插件,可以在特定時區(qū)創(chuàng)建對象的實例,效果很好,但我不能說我希望對象指向什么時間.

                Moment.js have a plugin that can create instances of the object in specific time zones and it works great, but I can't say what time I want the object to point to.

                如果我在紐約并且我這樣做:

                If I'm in New York and I do this:

                var time = moment("2013-08-26 16:55:00").tz("America/Los_Angeles");
                

                結(jié)果時間將是 13:55 而不是 16:55,但在洛杉磯.

                the resulting time will be 13:55 instead of 16:55 but in LA.

                我想要創(chuàng)建一個顯示 16:55 但在洛杉磯時間的實例.

                What I want is to create an instance that will say 16:55, but in LA time.

                我問的原因是因為我想這樣做:

                The reason I'm asking is because I want to do this:

                var now = moment.tz("America/Los_Angeles");
                var end = moment("2013-08-26 16:55:00"); //plus something to convert LA time
                
                var timeLeft = end.diff(now, "minutes");
                

                有沒有辦法做到這一點?

                Is there a way to do that?

                推薦答案

                在大多數(shù)情況下,您可以簡單地這樣做:

                In most cases, you can simply do this:

                moment.tz("2013-08-26 16:55:00", "America/Los_Angeles")
                

                如果需要輸入非ISO8601,則第二個參數(shù)指定格式字符串,第三個參數(shù)指定時區(qū):

                If you require input other than ISO8601, then specify the format string as the second parameter, and the time zone as the third:

                moment.tz("8/26/2013 4:55 pm", "M/D/YYYY h:mm a", "America/Los_Angeles")
                

                而如果你需要使用moment的嚴(yán)格解析"模式,則進入第三個參數(shù),時區(qū)移動到第四個位置:

                And if you need to use moment's "strict parsing" mode, then that goes in the third parameter, and the time zone moves to the fourth position:

                moment.tz("8/26/2013 4:55 pm", "M/D/YYYY h:mm a", true, "America/Los_Angeles")
                

                這篇關(guān)于如何使用 moment.js 在特定時區(qū)創(chuàng)建時間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調(diào)用完成)
                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
                Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

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

                    <tbody id='ADBtS'></tbody>

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

                        <legend id='ADBtS'><style id='ADBtS'><dir id='ADBtS'><q id='ADBtS'></q></dir></style></legend>
                      2. <tfoot id='ADBtS'></tfoot>

                          <bdo id='ADBtS'></bdo><ul id='ADBtS'></ul>
                          主站蜘蛛池模板: 久久婷婷av | 精品一区欧美 | 精品久久电影 | 美女久久视频 | 天天色天天 | 自拍中文字幕 | a在线免费观看视频 | 99综合网| 欧美伦理一区 | 亚洲一区二区中文字幕 | 久视频在线观看 | 日韩欧美网 | 国产在线中文 | 久久久久久亚洲精品不卡 | 在线播放中文字幕 | 91精品国产综合久久婷婷香蕉 | 国产精品久久久久久久久久久久 | 中文字幕欧美一区二区 | 91精品久久久久久久久久 | 国产成人免费视频 | 手机在线一区二区三区 | 激情网站在线观看 | 亚洲精品乱码久久久久久按摩 | 综合伊人 | 四虎影院在线播放 | 国产精品特级毛片一区二区三区 | 成人精品鲁一区一区二区 | 三级黄视频在线观看 | 色桃网| 亚洲成人精选 | 亚洲国产一区二区三区在线观看 | 国产视频久久久 | 中文字幕在线观看国产 | 一区二区三区四区在线 | 天堂中文av| 久久久99国产精品免费 | 在线一区视频 | 无码日韩精品一区二区免费 | 欧产日产国产精品视频 | 国内精品视频在线 | 男人天堂免费在线 |