time()
keeps producing the same timestamp , even though in my php.ini I keep toggling between
date.timezone = "Asia/Irkutsk"
and
date.timezone = "Europe/Belgrade"
phpinfo():
date/time support enabled
"Olson" Timezone Database Version 2012.3
Timezone Database internal
Default timezone Asia/Irkutsk
date/time support enabled
"Olson" Timezone Database Version 2012.3
Timezone Database internal
Default timezone Europe/Belgrade
Timestamps stays the same. Howcome?
You made the wrong assumption.
Unix timestamps are always in UTC. No exception. Changing the timezone does not change the exact moment of the epoch (1st of january, 1970), so the number of seconds since then will always be 'correct'.
您需要在php.ini中进行更改后重新启动PHP
I was having this problem and spoke to my host, they explained that any timezone setting in php.ini is ignored and that the .htaccess file must be changed as follows;
Add this to .htaccess
php_value date.timezone "Europe/London"
Then display using
echo date('d-m-Y H:i');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.