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

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

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

        您如何处理 PHP 中的时区差异计算?

        How do you handle timezone difference calculation in PHP?(您如何处理 PHP 中的时区差异计算?)
          <bdo id='iw1WR'></bdo><ul id='iw1WR'></ul>

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

            1. <legend id='iw1WR'><style id='iw1WR'><dir id='iw1WR'><q id='iw1WR'></q></dir></style></legend><tfoot id='iw1WR'></tfoot>
              <i id='iw1WR'><tr id='iw1WR'><dt id='iw1WR'><q id='iw1WR'><span id='iw1WR'><b id='iw1WR'><form id='iw1WR'><ins id='iw1WR'></ins><ul id='iw1WR'></ul><sub id='iw1WR'></sub></form><legend id='iw1WR'></legend><bdo id='iw1WR'><pre id='iw1WR'><center id='iw1WR'></center></pre></bdo></b><th id='iw1WR'></th></span></q></dt></tr></i><div id='iw1WR'><tfoot id='iw1WR'></tfoot><dl id='iw1WR'><fieldset id='iw1WR'></fieldset></dl></div>
                    <tbody id='iw1WR'></tbody>
                  本文介绍了您如何处理 PHP 中的时区差异计算?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有人告诉我,以下计算用户当地时间的方法有时不起作用.在 PHP 中执行此操作的最佳方法是什么?你是做什么的?

                  I'm being told that this below method of calculating the user's local time is sometimes not working. What's the best way to do this in PHP? What do you do?

                  public function getTimeOffset ($time) {
                      $this->_cacheTimeOffset();  
                      if ($this->timeOffsetExecuted) {
                          $d = date("O");
                          $neg = 1;
                  
                          if (substr($d, 0, 1) == "-") {
                              $neg = -1;
                              $d = substr($d, 1);
                          }
                  
                          $h = substr($d, 0, 2)*3600;
                          $m = substr($d, 2)*60;
                  
                          return $time + ($neg * ($h + $m) * -1) + (($this->timeOffset + $this->getDstInUse()) * 3600);
                      }
                      return $time;
                  }
                  

                  推荐答案

                  使用 DateTime 扩展,例如 日期时间::getOffset,
                  或 DateTimeZone::getOffset

                  Use the DateTime extension, such as DateTime::getOffset,
                  or DateTimeZone::getOffset

                  某些国家/地区可能会执行多次时区更新,
                  这个方法DateTimeZone::getTransitions 显示转换历史

                  Some countries might have perform several timezone update,
                  this method DateTimeZone::getTransitions reveal the transition history

                  这篇关于您如何处理 PHP 中的时区差异计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <legend id='1QwEi'><style id='1QwEi'><dir id='1QwEi'><q id='1QwEi'></q></dir></style></legend>
                  <i id='1QwEi'><tr id='1QwEi'><dt id='1QwEi'><q id='1QwEi'><span id='1QwEi'><b id='1QwEi'><form id='1QwEi'><ins id='1QwEi'></ins><ul id='1QwEi'></ul><sub id='1QwEi'></sub></form><legend id='1QwEi'></legend><bdo id='1QwEi'><pre id='1QwEi'><center id='1QwEi'></center></pre></bdo></b><th id='1QwEi'></th></span></q></dt></tr></i><div id='1QwEi'><tfoot id='1QwEi'></tfoot><dl id='1QwEi'><fieldset id='1QwEi'></fieldset></dl></div>

                      • <bdo id='1QwEi'></bdo><ul id='1QwEi'></ul>
                        <tfoot id='1QwEi'></tfoot>

                        <small id='1QwEi'></small><noframes id='1QwEi'>

                          <tbody id='1QwEi'></tbody>