system time is different than apache timestamp --?

爷,独闯天下 提交于 2020-01-02 05:06:11

问题


Im on a development server. When i do this in php:

echo date('r',time());

response: Tue, 01 Jun 2010 18:10:32 -0400

However, my computer's time is 17:10:32 (im on GMT -5). Where do i configure my apache/php to change this setting? i've looked in php.ini and httpd.conf already.

Thanks


回答1:


Edit your php.ini file and add the following code in the Date section

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/Guayaquil

That will define the timezone for all your php pages.




回答2:


To set your server's time-zone add a line to your .htaccess file:

SetEnv TZ America/Indianapolis

For a list of supported timezones:

http://www.php.net/manual/en/timezones.america.php



来源:https://stackoverflow.com/questions/2953748/system-time-is-different-than-apache-timestamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!