douyun7718 2016-05-01 23:24
浏览 223
已采纳

php.ini'date.timezone'没有任何效果

In my php.ini I've set:

date.timezone = "Etc/UTC"

And the server's time is UTC+0 too, but when I try this script to get the timezone:

<?php print(date_default_timezone_get()); ?>

it returns

Europe/Berlin

which is UTC+2 and not UTC+0 and I don't see how it gets there.

Just to clearify:

  • I have saved the the correct file at the correct path and restarted my server
  • I do not want to modify my scripts, because I already used date() way to often
  • I want the time to be UTC+0 for PHP just by changing the configuration
  • I want it to be UTC+0 at all times, ignoring Summer-/Wintertime
  • 写回答

5条回答 默认 最新

  • douchi8503 2016-10-06 09:35
    关注

    In the comments, Minesh Patel told me to check if there is something overwriting my option, so I searched through my php.ini for Europe/Berlin and it turns out there was another date.timezone-entry that overwrote it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 根据历年月数据,用Stata预测未来六个月汇率
  • ¥15 DevEco studio开发工具 真机联调找不到手机设备
  • ¥15 请教前后端分离的问题
  • ¥100 冷钱包突然失效,急寻解决方案
  • ¥15 下载honeyd时报错 configure: error: you need to instal a more recent version of libdnet
  • ¥15 距离软磁铁一定距离的磁感应强度大小怎么求
  • ¥15 霍尔传感器hmc5883l的xyz轴输出和该点的磁感应强度大小的关系是什么
  • ¥15 vscode开发micropython,import模块出现异常
  • ¥20 Excel数据自动录入表单并提交
  • ¥30 silcavo仿真,30分钟,只需要代码
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部