Discuz User's home page can see its time zone, background can also set time zone, this is the international route Ah
I'm thinking about it. The whole system is not used for Greenwich Mean time, and then converted to local times based on the user's time zone
For example, a forum with users in China and the United States to post online, the system record the time of posting is the world time
I only catch the system there is a .\source\class\discuz\discuz_application.php
class inside there is a timezone_set()
method of @date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
This setting $timeoffset
is actually 0 ah, that is, set the GMT ah ...
Who is familiar with the source of DZ, pointing to me a bit of thought ha, thank you!
Reply content:
Discuz User's home page can see its time zone, background can also set time zone, this is the international route Ah
I'm thinking about it. The whole system is not used for Greenwich Mean time, and then converted to local times based on the user's time zone
For example, a forum with users in China and the United States to post online, the system record the time of posting is the world time
I only catch the system there is a .\source\class\discuz\discuz_application.php
class inside there is a timezone_set()
method of @date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
This setting $timeoffset
is actually 0 ah, that is, set the GMT ah ...
Who is familiar with the source of DZ, pointing to me a bit of thought ha, thank you!
Regardless of how you set the time zone, the timestamp of the Times function is fixed, not because the time zone is different, just call date, the time zone will play a role, you can understand that if you are in the East Eight, then date (' y-m-d ') is actually date (' y-m-d ' () +8*3600), so the so-called internationalization can be done, store the user's time zone, and then redefine a date formatting function, such as
function localdate( $format, $time_zone ){ return date($format,time()+$time_zone*3600)}
No one knows?