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

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

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

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

        <tfoot id='rT6d2'></tfoot>

      1. 在用戶的時區顯示日期/時間 - 在客戶端

        Displaying date/time in user#39;s timezone - on client side(在用戶的時區顯示日期/時間 - 在客戶端)

              <tbody id='YsITF'></tbody>

            <tfoot id='YsITF'></tfoot>

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

            <i id='YsITF'><tr id='YsITF'><dt id='YsITF'><q id='YsITF'><span id='YsITF'><b id='YsITF'><form id='YsITF'><ins id='YsITF'></ins><ul id='YsITF'></ul><sub id='YsITF'></sub></form><legend id='YsITF'></legend><bdo id='YsITF'><pre id='YsITF'><center id='YsITF'></center></pre></bdo></b><th id='YsITF'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YsITF'><tfoot id='YsITF'></tfoot><dl id='YsITF'><fieldset id='YsITF'></fieldset></dl></div>
              <legend id='YsITF'><style id='YsITF'><dir id='YsITF'><q id='YsITF'></q></dir></style></legend>
                <bdo id='YsITF'></bdo><ul id='YsITF'></ul>
                  本文介紹了在用戶的時區顯示日期/時間 - 在客戶端的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個在每個頁面上顯示日期時間戳的 Web 應用程序,例如:

                  I have a web application that displays datetime stamps on every page, for example:

                  2009 年 12 月 12 日下午 6:00

                  December 12, 2009 6:00 pm

                  我想動態檢測用戶的時區并使用 JavaScript 更改顯示.

                  I would like to dynamically detect the user's timezone and alter the display using JavaScript.

                  所以紐約用戶會看到:

                  2009 年 12 月 12 日下午 6:00

                  December 12, 2009 6:00 pm

                  雖然加利福尼亞用戶會看到:

                  While the California user would see:

                  2009 年 12 月 12 日下午 3:00

                  December 12, 2009 3:00 pm

                  有什么建議嗎?

                  推薦答案

                  以下是您可以如何通過精彩的漸進式增強"來做到這一點:

                  Here is how you could do it with the wonderful "progressive enhancement":

                  輸出你希望它出現的日期,但一定要指定它的時區(我在這里使用 GMT,但你可以使用 UTC 等).然后將其替換為加載時的本地時間(如果提供了原始時區,則由 JavaScript 自動處理).

                  Output the date where you want it to appear, but be sure to specify its timezone (I use GMT here, but you could use UTC, etc). Then swap it out with the local time on load (Automatically handled by JavaScript if the original timezone is provided).

                  <div id="timestamp">December 12, 2009 6:00 pm GMT</div>
                  <script type="text/javascript">
                      var timestamp = document.getElementById('timestamp'),
                          t         = new Date(timestamp.innerHTML),
                          hours     = t.getHours(), 
                          min       = t.getMinutes() + '', 
                          pm        = false,
                          months    = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
                  
                      if(hours > 11){
                         hours = hours - 12;
                         pm = true;
                      }
                  
                      if(hours == 0) hours = 12;
                      if(min.length == 1) min = '0' + min;
                  
                      timestamp.innerHTML = months[t.getMonth()] + ' ' + t.getDate() + ', ' + t.getFullYear() + ' ' + hours + ':' + min + ' ' + (pm ? 'pm' : 'am');
                  </script>
                  

                  這篇關于在用戶的時區顯示日期/時間 - 在客戶端的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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() 的限制?)

                    <bdo id='3M71O'></bdo><ul id='3M71O'></ul>
                    <legend id='3M71O'><style id='3M71O'><dir id='3M71O'><q id='3M71O'></q></dir></style></legend>
                        <tbody id='3M71O'></tbody>
                      <tfoot id='3M71O'></tfoot>

                      <small id='3M71O'></small><noframes id='3M71O'>

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

                            主站蜘蛛池模板: 国产激情视频网址 | 91久久| 亚洲精品日韩视频 | 婷婷综合久久 | 日本一区二区不卡视频 | 欧美中文字幕一区二区三区亚洲 | 91成人免费看片 | 国产欧美一区二区精品久导航 | 一区网站 | 久久精品在线免费视频 | 成人在线视频网址 | 亚洲一区网站 | 国产成人短视频在线观看 | 一区二区三区影院 | 精品久久久久久18免费网站 | 亚洲国产精品suv | 亚洲精品99 | 国产视频久久 | 国产一级片免费在线观看 | 手机在线一区二区三区 | 国产精品免费小视频 | 日韩在线欧美 | 51ⅴ精品国产91久久久久久 | 九九九视频在线观看 | 国外成人在线视频网站 | 精品免费视频 | 2020天天操| 黄色一级毛片免费看 | 日韩视频在线免费观看 | 日本韩国欧美在线观看 | 国产成人艳妇aa视频在线 | 欧美精品a∨在线观看不卡 欧美日韩中文字幕在线播放 | 国产成人精品一区二区三区网站观看 | 亚洲二区视频 | 伊人二区 | 最新中文字幕在线 | 欧美视频在线播放 | 精品麻豆剧传媒av国产九九九 | 国产精品精品久久久 | 99久久久无码国产精品 | 国产传媒 |