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

    <tfoot id='WPHqY'></tfoot>

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

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

        <bdo id='WPHqY'></bdo><ul id='WPHqY'></ul>
      <legend id='WPHqY'><style id='WPHqY'><dir id='WPHqY'><q id='WPHqY'></q></dir></style></legend>
      1. 不同語(yǔ)言環(huán)境和時(shí)區(qū)的 Javascript 日期對(duì)象

        Javascript date object in different locale and timezone(不同語(yǔ)言環(huán)境和時(shí)區(qū)的 Javascript 日期對(duì)象)
      2. <i id='Hec3p'><tr id='Hec3p'><dt id='Hec3p'><q id='Hec3p'><span id='Hec3p'><b id='Hec3p'><form id='Hec3p'><ins id='Hec3p'></ins><ul id='Hec3p'></ul><sub id='Hec3p'></sub></form><legend id='Hec3p'></legend><bdo id='Hec3p'><pre id='Hec3p'><center id='Hec3p'></center></pre></bdo></b><th id='Hec3p'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Hec3p'><tfoot id='Hec3p'></tfoot><dl id='Hec3p'><fieldset id='Hec3p'></fieldset></dl></div>
        • <legend id='Hec3p'><style id='Hec3p'><dir id='Hec3p'><q id='Hec3p'></q></dir></style></legend>

          <tfoot id='Hec3p'></tfoot>

              <tbody id='Hec3p'></tbody>
              • <bdo id='Hec3p'></bdo><ul id='Hec3p'></ul>

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

                  本文介紹了不同語(yǔ)言環(huán)境和時(shí)區(qū)的 Javascript 日期對(duì)象的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我需要編寫一個(gè) Web 應(yīng)用程序來(lái)顯示不同地區(qū)的人們的事件.我差不多完成了,但是日期有兩個(gè)問(wèn)題:

                  I need to write a web application that show events of people in different locale. I almost finished it, but there're 2 problems with date:

                  • 使用日期 javascript 對(duì)象,日期取決于用戶計(jì)算機(jī)設(shè)置,并不可靠
                  • 如果在具有不同時(shí)區(qū)的地方發(fā)生事件尊重用戶當(dāng)前位置,我必須在 () 內(nèi)打印它.是否可以在 javascript 中構(gòu)建具有給定時(shí)區(qū)和日光設(shè)置的日期對(duì)象?
                  • using date javascript object, the date depends on user computer settings and it's not reliable
                  • if there's an event in a place with dfferent timezone respect user current position, i have to print it inside (). Is it possible in javascript to build a date object with a given timezone and daylight settings?

                  我還找到了一些解決方法,例如 jsdate 和 date webservices,但它們并沒(méi)有解決具有正確時(shí)區(qū)和日光設(shè)置的 javascript 對(duì)象的問(wèn)題(用于日期操作,例如添加天數(shù)等).

                  I also find some workaround, such as jsdate and date webservices, but they don't overcome the problem of having a javascript object with the correct timezone and daylight settings (for date operation such as adding days and so on).

                  推薦答案

                  有幾點(diǎn)要記住.

                  以 UTC 時(shí)間存儲(chǔ)所有事件日期時(shí)間

                  是的,沒(méi)有辦法解決這個(gè)問(wèn)題.

                  Yes, there is no getting around this.

                  找出所有時(shí)區(qū)...

                  ...系統(tǒng)中的所有用戶.您可以使用以下檢測(cè)腳本:http://site.pageloom.com/automatic-timezone-detection-with-javascript.它會(huì)給你一個(gè)時(shí)區(qū)鍵,例如America/Phoenix".

                  ...of all the users in the system. You can use the following detection script: http://site.pageloom.com/automatic-timezone-detection-with-javascript. It will hand you a timezone key such as for example "America/Phoenix".

                  在您的情況下,您需要將時(shí)區(qū)與事件一起存儲(chǔ),因?yàn)橛脩艨赡軙?huì)切換時(shí)區(qū) - 但事件將始終在特定時(shí)區(qū)發(fā)生.(啊)

                  In your case you need to store the timezone together with the event, since a user may switch timezone - but the event will always have happened in a specific one. (argh)

                  選擇您的顯示機(jī)制

                  如果您想使用 Javascript 本地化您的活動(dòng)日期,也有一個(gè)漂亮的庫(kù)(可以使用上一個(gè)腳本提供的鍵).這里:https://github.com/mde/timezone-js.

                  If you want to localize your event dates with Javascript, there is a nifty library for that too (which can use the keys supplied with the previous script). Here: https://github.com/mde/timezone-js.

                  使用該庫(kù),您可以執(zhí)行以下操作:

                  with that library you can for example do this:

                  var dt = new timezoneJS.Date(UTC_TIMESTAMP, 'America/New_York');
                  

                  var dt = new timezoneJS.Date(2006, 9, 29, 1, 59, 'America/Los_Angeles');
                  

                  例如,UTC_TIMESTAMP 可以是 1193855400000.America/New_York是您在事件發(fā)生時(shí)檢測(cè)到的時(shí)區(qū).

                  where UTC_TIMESTAMP for example could be 1193855400000. And America/New_Yorkis the timezone you have detected when the event took place.

                  您從中獲得的 dt 對(duì)象將表現(xiàn)為普通的 JavaScript Date 對(duì)象.但會(huì)自動(dòng)更正"到您指定的時(shí)區(qū)(包括 DST).

                  The dt object that you get from this will behave as a normal JavaScript Date object. But will automatically "correct" itself to the timezone you have specified (including DST).

                  如果您愿意,您可以在提供頁(yè)面之前在后端進(jìn)行所有更正.因?yàn)槲也恢滥阍谀抢锸褂檬裁淳幊陶Z(yǔ)言,所以我不能給你任何直接的提示.但基本上它遵循相同的邏輯,如果您知道時(shí)區(qū)和 UTC 日期時(shí)間 -> 您可以本地化日期時(shí)間.所有編程語(yǔ)言都有相應(yīng)的庫(kù).

                  If you want to, you can do all the corrections in the backend - before you serve the page. Since I don't know what programming language you are using there, I cannot give you any immediate tips. But basically it follows the same logic, if you know the timezone, and the UTC datetime -> you can localize the datetime. All programming languages have libraries for that.

                  這篇關(guān)于不同語(yǔ)言環(huán)境和時(shí)區(qū)的 Javascript 日期對(duì)象的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 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 無(wú)法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                      • <tfoot id='Hghyd'></tfoot>
                          <tbody id='Hghyd'></tbody>
                        <legend id='Hghyd'><style id='Hghyd'><dir id='Hghyd'><q id='Hghyd'></q></dir></style></legend>

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

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

                            主站蜘蛛池模板: 欧美成人精品一区二区男人看 | 一区二区三区四区免费在线观看 | 超碰在线观看97 | 国产馆 | 一区欧美 | 成人免费精品视频 | 国产色在线 | 日韩不卡一区二区 | 一区二区三区国产精品 | 亚州春色 | 亚洲国产aⅴ成人精品无吗 国产精品永久在线观看 | 热久久久久 | 一级黄色生活视频 | 日韩免费在线观看视频 | www国产亚洲精品久久网站 | 97精品超碰一区二区三区 | 成人性视频免费网站 | 狠狠操狠狠操 | 欧美日韩视频在线 | 一区二区三区四区在线视频 | 国产精品影视在线观看 | 一区欧美 | 亚洲综合精品 | 久久久精品 | 99精品免费久久久久久久久日本 | 情侣黄网站免费看 | 精品一区二区三区在线观看国产 | 男人的天堂久久 | 黄色网址免费在线观看 | 国产一区二区视频免费在线观看 | 欧美高清dvd | h在线免费观看 | 中文字幕一区二区三 | 成人在线视频免费播放 | 精品国产不卡一区二区三区 | 久久久久久99 | 99精品国自产在线观看 | 成人免费淫片aa视频免费 | 精品视频在线观看 | 黄色在线免费观看 | 人成在线|