开发者

PHP default timezone

开发者 https://www.devze.com 2023-02-23 02:34 出处:网络
there is a function in php to set default timezone- date_default_timez开发者_如何学编程one_set(\'Asia/Calcutta\');

there is a function in php to set default timezone-

date_default_timez开发者_如何学编程one_set('Asia/Calcutta');

but does this need to be called every time in the application, whenever I want to make use of date?


but does this need to be called every time in the application, whenever I want to make use of date?

If your application needs a different timezone than configured in php.ini, then yes, you need to call date_default_timezone_set in your script. You will also need to call it if there is no timezone configured in php.ini, though if that is the case, you need to pester your host to fix it.


You can set the timezone in php.ini and then not have to worry about calling it in your script each time: http://php.net/manual/en/datetime.configuration.php

0

精彩评论

暂无评论...
验证码 换一张
取 消