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

  1. <tfoot id='kxrlu'></tfoot>

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

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

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

      尽管时间戳正确,PHP 日期仍显示错误时间

      PHP date showing wrong time despite the timestamp being correct(尽管时间戳正确,PHP 日期仍显示错误时间)

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

        <bdo id='YI3on'></bdo><ul id='YI3on'></ul>
      • <small id='YI3on'></small><noframes id='YI3on'>

            <legend id='YI3on'><style id='YI3on'><dir id='YI3on'><q id='YI3on'></q></dir></style></legend>

              <i id='YI3on'><tr id='YI3on'><dt id='YI3on'><q id='YI3on'><span id='YI3on'><b id='YI3on'><form id='YI3on'><ins id='YI3on'></ins><ul id='YI3on'></ul><sub id='YI3on'></sub></form><legend id='YI3on'></legend><bdo id='YI3on'><pre id='YI3on'><center id='YI3on'></center></pre></bdo></b><th id='YI3on'></th></span></q></dt></tr></i><div id='YI3on'><tfoot id='YI3on'></tfoot><dl id='YI3on'><fieldset id='YI3on'></fieldset></dl></div>
              1. 本文介绍了尽管时间戳正确,PHP 日期仍显示错误时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我遇到了 PHP 日期函数的问题,我以前从未遇到过问题.

                I'm having a problem with the PHP date function which I've never had a problem with before.

                时间戳完全正确,但是由于某些奇怪的原因 date() 输出的时间不对应.

                The timestamp is entirely correct, however for some bizarre reason date() is outputting a time which does not correspond.

                我有以下时间戳(这绝对是正确的 - 当我将其回显到页面以及数据库中时,它显示为正确):

                I have the following timestamp (and this is definitely the correct one - when I echo it out onto the page, as well as in the database, it shows as being correct):

                464400
                

                然而,当我使用以下代码行时:

                Yet when I use the following line of code:

                <?php echo date("H:i",$timestamp); ?>
                

                我的时间是凌晨 4 点?如果我将时间戳粘贴到时间戳转换器网站中,则显示时间实际上应该是上午 9 点.

                I'm getting a time of 4 am? If I paste the timestamp into a timestamp converter website, then it shows the time should in fact be 9am.

                我完全被卡住了,这在我之前从未发生过&这个问题是最近才出现的——代码没有改变,之前一切似乎都正常工作.

                I'm completely stuck, this has never happened to me before & this problem has only just come up recently - the code hasn't been changed and everything seemed to be working correctly before.

                有人对这个问题有任何经验吗?任何帮助将不胜感激.

                Does anyone have any experience with this issue? Any help would be appreciated.

                推荐答案

                那个时间戳是 9am GMT 时区,如果你在另一个时区,那么你需要相应地调整它.

                That time stamp is is 9am GMT timezone, if you are in another timezone then you will need to adjust it accordingly.

                http://php.net/manual/en/function.date-default-timezone-set.php

                  date_default_timezone_set('Europe/London');
                

                在你的 php.ini 中甚至更好

                or even better in your php.ini

                http://php.net/manual/en/datetime.configuration.php

                date.timezone="Europe/London"
                

                或者您可以更具体地使用 GMT 而不是欧洲/伦敦(有 DST)

                Or you can use more specifically GMT instead of Europe/London (which has DST)

                这篇关于尽管时间戳正确,PHP 日期仍显示错误时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                datetime to timestamp(日期时间到时间戳)
                PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)
                • <bdo id='MVqwW'></bdo><ul id='MVqwW'></ul>
                  <i id='MVqwW'><tr id='MVqwW'><dt id='MVqwW'><q id='MVqwW'><span id='MVqwW'><b id='MVqwW'><form id='MVqwW'><ins id='MVqwW'></ins><ul id='MVqwW'></ul><sub id='MVqwW'></sub></form><legend id='MVqwW'></legend><bdo id='MVqwW'><pre id='MVqwW'><center id='MVqwW'></center></pre></bdo></b><th id='MVqwW'></th></span></q></dt></tr></i><div id='MVqwW'><tfoot id='MVqwW'></tfoot><dl id='MVqwW'><fieldset id='MVqwW'></fieldset></dl></div>
                      <tbody id='MVqwW'></tbody>

                  1. <tfoot id='MVqwW'></tfoot>
                  2. <small id='MVqwW'></small><noframes id='MVqwW'>

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