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

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度