<bdo id='9t4HB'></bdo><ul id='9t4HB'></ul>

    1. <legend id='9t4HB'><style id='9t4HB'><dir id='9t4HB'><q id='9t4HB'></q></dir></style></legend>

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

      <small id='9t4HB'></small><noframes id='9t4HB'>

      1. 我可以在 ASP.NET 中获取浏览器时区还是必须依靠 JS 操作来检索信息?

        时间:2023-10-07
        <i id='wfkGa'><tr id='wfkGa'><dt id='wfkGa'><q id='wfkGa'><span id='wfkGa'><b id='wfkGa'><form id='wfkGa'><ins id='wfkGa'></ins><ul id='wfkGa'></ul><sub id='wfkGa'></sub></form><legend id='wfkGa'></legend><bdo id='wfkGa'><pre id='wfkGa'><center id='wfkGa'></center></pre></bdo></b><th id='wfkGa'></th></span></q></dt></tr></i><div id='wfkGa'><tfoot id='wfkGa'></tfoot><dl id='wfkGa'><fieldset id='wfkGa'></fieldset></dl></div>

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

            <bdo id='wfkGa'></bdo><ul id='wfkGa'></ul>

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

                <tbody id='wfkGa'></tbody>
                <tfoot id='wfkGa'></tfoot>

                1. 本文介绍了我可以在 ASP.NET 中获取浏览器时区还是必须依靠 JS 操作来检索信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  能否在 ASP.NET 中获取浏览器时区,还是必须依靠 JS 操作来检索信息

                  Can I get the browser time zone in ASP.NET or do I have to rely on JS operations to retrieve the information

                  推荐答案

                  没有Accept-Timezone"标头(或类似的) - HTTP 标准不包含任何工具来允许浏览器自动告诉服务器什么用户关心的时区.

                  There is no "Accept-Timezone" header (or the like) - the HTTP standard does not contain any facility to allow the browser to automatically tell the server what time zone the user cares about.

                  基本方法是使用日期并从中读取 TZ 信息.

                  The basic approach is to use a date and read the TZ info from it.

                  由于没有标准(跨浏览器时区命名功能 - 您必须求助于(哎呀!):

                  Since there's no standard (cross-browser time zone naming functions - you have to resort to something like (yikes!):

                  function getTimezoneName() {
                      tmSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
                      so = -1 * tmSummer.getTimezoneOffset();
                      tmWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
                      wo = -1 * tmWinter.getTimezoneOffset();
                  
                      if (-660 == so && -660 == wo) return 'Pacific/Midway';
                      if (-600 == so && -600 == wo) return 'Pacific/Tahiti';
                      if (-570 == so && -570 == wo) return 'Pacific/Marquesas';
                      if (-540 == so && -600 == wo) return 'America/Adak';
                      if (-540 == so && -540 == wo) return 'Pacific/Gambier';
                      if (-480 == so && -540 == wo) return 'US/Alaska';
                      if (-480 == so && -480 == wo) return 'Pacific/Pitcairn';
                      if (-420 == so && -480 == wo) return 'US/Pacific';
                      if (-420 == so && -420 == wo) return 'US/Arizona';
                      if (-360 == so && -420 == wo) return 'US/Mountain';
                      if (-360 == so && -360 == wo) return 'America/Guatemala';
                      if (-360 == so && -300 == wo) return 'Pacific/Easter';
                      if (-300 == so && -360 == wo) return 'US/Central';
                      if (-300 == so && -300 == wo) return 'America/Bogota';
                      if (-240 == so && -300 == wo) return 'US/Eastern';
                      if (-240 == so && -240 == wo) return 'America/Caracas';
                      if (-240 == so && -180 == wo) return 'America/Santiago';
                      if (-180 == so && -240 == wo) return 'Canada/Atlantic';
                      if (-180 == so && -180 == wo) return 'America/Montevideo';
                      if (-180 == so && -120 == wo) return 'America/Sao_Paulo';
                      if (-150 == so && -210 == wo) return 'America/St_Johns';
                      if (-120 == so && -180 == wo) return 'America/Godthab';
                      if (-120 == so && -120 == wo) return 'America/Noronha';
                      if (-60 == so && -60 == wo) return 'Atlantic/Cape_Verde';
                      if (0 == so && -60 == wo) return 'Atlantic/Azores';
                      if (0 == so && 0 == wo) return 'Africa/Casablanca';
                      if (60 == so && 0 == wo) return 'Europe/London';
                      if (60 == so && 60 == wo) return 'Africa/Algiers';
                      if (60 == so && 120 == wo) return 'Africa/Windhoek';
                      if (120 == so && 60 == wo) return 'Europe/Amsterdam';
                      if (120 == so && 120 == wo) return 'Africa/Harare';
                      if (180 == so && 120 == wo) return 'Europe/Athens';
                      if (180 == so && 180 == wo) return 'Africa/Nairobi';
                      if (240 == so && 180 == wo) return 'Europe/Moscow';
                      if (240 == so && 240 == wo) return 'Asia/Dubai';
                      if (270 == so && 210 == wo) return 'Asia/Tehran';
                      if (270 == so && 270 == wo) return 'Asia/Kabul';
                      if (300 == so && 240 == wo) return 'Asia/Baku';
                      if (300 == so && 300 == wo) return 'Asia/Karachi';
                      if (330 == so && 330 == wo) return 'Asia/Calcutta';
                      if (345 == so && 345 == wo) return 'Asia/Katmandu';
                      if (360 == so && 300 == wo) return 'Asia/Yekaterinburg';
                      if (360 == so && 360 == wo) return 'Asia/Colombo';
                      if (390 == so && 390 == wo) return 'Asia/Rangoon';
                      if (420 == so && 360 == wo) return 'Asia/Almaty';
                      if (420 == so && 420 == wo) return 'Asia/Bangkok';
                      if (480 == so && 420 == wo) return 'Asia/Krasnoyarsk';
                      if (480 == so && 480 == wo) return 'Australia/Perth';
                      if (540 == so && 480 == wo) return 'Asia/Irkutsk';
                      if (540 == so && 540 == wo) return 'Asia/Tokyo';
                      if (570 == so && 570 == wo) return 'Australia/Darwin';
                      if (570 == so && 630 == wo) return 'Australia/Adelaide';
                      if (600 == so && 540 == wo) return 'Asia/Yakutsk';
                      if (600 == so && 600 == wo) return 'Australia/Brisbane';
                      if (600 == so && 660 == wo) return 'Australia/Sydney';
                      if (630 == so && 660 == wo) return 'Australia/Lord_Howe';
                      if (660 == so && 600 == wo) return 'Asia/Vladivostok';
                      if (660 == so && 660 == wo) return 'Pacific/Guadalcanal';
                      if (690 == so && 690 == wo) return 'Pacific/Norfolk';
                      if (720 == so && 660 == wo) return 'Asia/Magadan';
                      if (720 == so && 720 == wo) return 'Pacific/Fiji';
                      if (720 == so && 780 == wo) return 'Pacific/Auckland';
                      if (765 == so && 825 == wo) return 'Pacific/Chatham';
                      if (780 == so && 780 == wo) return 'Pacific/Enderbury'
                      if (840 == so && 840 == wo) return 'Pacific/Kiritimati';
                      return 'US/Pacific';
                  }
                  

                  这篇关于我可以在 ASP.NET 中获取浏览器时区还是必须依靠 JS 操作来检索信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 UTC 日期时间转换为另一个时区 下一篇:如何使用 C#/.NET 将日期时间转换为时间戳(忽略当前时区)

                  相关文章

                  <tfoot id='sbdrr'></tfoot>

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

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

                    • <bdo id='sbdrr'></bdo><ul id='sbdrr'></ul>