dtvfxzq3802 2015-01-20 20:29
浏览 138
已采纳

PHP date()给出错误的时间 - CentOS服务器时间

CentOS 6.0. I noticed that the emails sent from ThunderBird client using this server are alright with correct time and everything. But when i send an email using php script, the email is received with -7:05h difference, therefore being received way behind the new emails. The time mysql uses when inserting a new row with ON_UPDATE CUR_TIMESTAMP is correct, but if i use php's date() function to get the time - it's with that -7:05h difference. Looking it up on Google always points out to a wrong timezone, but the php.ini is set to the correct one (America/Denver). When i change the php.ini to Europe/London the date() function prints correct time, but the emails still have the time difference.

**hwclock**
Tue 20 Jan 2015 01:22:37 PM GMT  -0.828380 seconds

**echo date('l jS \of F Y h:i:s A');**
Tuesday 20th of January 2015 06:07:35 AM
  • 写回答

1条回答 默认 最新

  • dousi6303 2015-01-20 20:42
    关注

    Your server time and the timezone don't match.

    The server time you show is Mountain time (America/Denver) but the timezone is GMT. GMT is 7 hours ahead of Mountain at the moment. So set the server time as the current GMT time and keep the GMT timezone, or alternately keep the Mountain time and set the timezone as Mountain time (America/Denver).

    I would go with setting the proper GMT time. At 2:00 PM Mountain time your server clock should be: Tue 20 Jan 2015 21:00:00 PM GMT

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出