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

    1. <small id='8wrW0'></small><noframes id='8wrW0'>

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

      1. <legend id='8wrW0'><style id='8wrW0'><dir id='8wrW0'><q id='8wrW0'></q></dir></style></legend>

        如何將 Moment.js 日期轉換為用戶本地時區?

        How to convert Moment.js date to users local timezone?(如何將 Moment.js 日期轉換為用戶本地時區?)

        <tfoot id='mCTp8'></tfoot>
            <legend id='mCTp8'><style id='mCTp8'><dir id='mCTp8'><q id='mCTp8'></q></dir></style></legend>

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

            1. <i id='mCTp8'><tr id='mCTp8'><dt id='mCTp8'><q id='mCTp8'><span id='mCTp8'><b id='mCTp8'><form id='mCTp8'><ins id='mCTp8'></ins><ul id='mCTp8'></ul><sub id='mCTp8'></sub></form><legend id='mCTp8'></legend><bdo id='mCTp8'><pre id='mCTp8'><center id='mCTp8'></center></pre></bdo></b><th id='mCTp8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mCTp8'><tfoot id='mCTp8'></tfoot><dl id='mCTp8'><fieldset id='mCTp8'></fieldset></dl></div>
                • <bdo id='mCTp8'></bdo><ul id='mCTp8'></ul>
                    <tbody id='mCTp8'></tbody>
                • 本文介紹了如何將 Moment.js 日期轉換為用戶本地時區?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我使用 Moment.js 和 Moment-Timezone 框架,并且有一個 Moment.js 日期對象,該對象明確使用 UTC 時區.如何將其轉換為瀏覽器的當前時區?

                  I use the Moment.js and Moment-Timezone frameworks, and have a Moment.js date object which is explicitly in UTC timezone. How can I convert that to the current timezone of the browser?

                  var testDateUtc = moment.tz("2015-01-30 10:00:00", "UTC");var localDate = ???

                  所以如果我能找出用戶的本地時區就好了;或者,我想將日期對象轉換為另一個只使用本地時區"的數據對象,無論它實際上是什么.

                  So it would be fine if I could find out the users local time zone; or alternatively I'd like to convert the date object into another data object which just uses the "local timezone", no matter what that actually is.

                  推薦答案

                  您不需要為此使用 moment-timezone.主要的 moment.js 庫具有使用 UTC 和本地時區的完整功能.

                  You do not need to use moment-timezone for this. The main moment.js library has full functionality for working with UTC and the local time zone.

                  var testDateUtc = moment.utc("2015-01-30 10:00:00");
                  var localDate = moment(testDateUtc).local();
                  

                  從那里您可以使用您可能期望的任何功能:

                  From there you can use any of the functions you might expect:

                  var s = localDate.format("YYYY-MM-DD HH:mm:ss");
                  var d = localDate.toDate();
                  // etc...
                  

                  請注意,通過將 testDateUtc(它是一個 moment 對象)傳回 moment() 構造函數,它會創建一個 克隆.否則,當您調用 .local() 時,它也會更改 testDateUtc 值,而不僅僅是 localDate 值.時刻是可變的.

                  Note that by passing testDateUtc, which is a moment object, back into the moment() constructor, it creates a clone. Otherwise, when you called .local(), it would also change the testDateUtc value, instead of just the localDate value. Moments are mutable.

                  另外請注意,如果您的原始輸入包含時區偏移量,例如 +00:00Z,那么您可以直接使用 moment 解析它.您不需要使用 .utc.local.例如:

                  Also note that if your original input contains a time zone offset such as +00:00 or Z, then you can just parse it directly with moment. You don't need to use .utc or .local. For example:

                  var localDate = moment("2015-01-30T10:00:00Z");
                  

                  這篇關于如何將 Moment.js 日期轉換為用戶本地時區?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  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標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                      <tbody id='SVNqx'></tbody>
                    <legend id='SVNqx'><style id='SVNqx'><dir id='SVNqx'><q id='SVNqx'></q></dir></style></legend>
                  1. <tfoot id='SVNqx'></tfoot>

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

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

                          • 主站蜘蛛池模板: 国产精品久久久99 | 91av在线电影 | 综合精品| 成人免费一区二区三区牛牛 | 成人午夜免费福利视频 | 国产特级毛片aaaaaa | 美女爽到呻吟久久久久 | 久久久久久九九九九九九 | 欧美日韩一区二区三区四区五区 | 欧美日韩一区二区在线观看 | 国产美女视频黄a视频免费 国产精品福利视频 | 久久天天躁狠狠躁夜夜躁2014 | 一级片在线播放 | 国产99小视频 | 国产一级视频在线观看 | 欧美日韩国产传媒 | 亚洲www. | 亚洲欧美在线一区 | 精品伊人 | 久久久久久色 | 久久久久久免费毛片精品 | 国产一区二区三区四区五区加勒比 | 久久久久久久久久久蜜桃 | 99热热 | 福利一区在线观看 | 欧美精品福利视频 | 日日摸日日碰夜夜爽亚洲精品蜜乳 | 国产一区二区三区免费观看在线 | 国产精品美女久久久久久久久久久 | 中文字幕视频三区 | 国产一二区在线 | 成人不卡 | 中文字幕国产第一页 | 欧美激情一区二区 | 久久草视频 | 国产夜恋视频在线观看 | 成人一区二区三区视频 | 国产精品一区二区免费 | 日韩1区 | 国产视频福利一区 | 亚洲自拍一区在线观看 |