I know the time zone can be changed by the following methods (and maybe more):
- Set
putenv()with the time zone in every php file. - Set
date.timezonewith the time zone in php.ini. - Set
php_value date.timezonewith the time zone in the root .htaccess file.
My question is, does setting the time zone only affect the date() function, or does it also affect the time() function?
I read the documentation, but I’m still a little confused.. I think the answer is the former, but I need to make sure, so it would be great if someone could confirm this.
Thanks!
time() isn’t affected by timezone. functions like date, convert the resulting date to the timezone without affecting the timestamp.
Outputs:
Demo: https://3v4l.org/Cggc3