How to change the php server time zone? [closed]

不想你离开。 提交于 2020-01-06 03:06:44

问题


We can use any simple code to display the system time only but I need some code to find the server(PHP) time zone and how to change the server time zone?


回答1:


date_default_timezone_set('America/Los_Angeles');

Change the value of America/Los_Angeles');




回答2:


Add this to the top of a PHP file, or to the top of an included file (if you can't get at the PHP.ini)...

date_default_timezone_set('America/Los_Angeles');

From php.net




回答3:


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

Here are timezones: http://www.php.net/manual/en/timezones.php

And this is how you use it:

date_default_timezone_set('Europe/Vilnius');



回答4:


For server: In the php.ini change the date.timezone variable

For script: Refer to the API: http://php.net/manual/en/function.date-default-timezone-set.php




回答5:


Use function date_default_timezone_set() in your PHP file.



来源:https://stackoverflow.com/questions/13229564/how-to-change-the-php-server-time-zone

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