On the Discuz user's homepage, you can see the time zone in which it is located, and you can set the time zone in the background. This is an international route. I am wondering if the entire system uses Greenwich Mean Time, then convert the time zone to the local time. For example, if a forum has users in China and the United States posting online at the same time ,... on the Discuz user homepage, you can see the time zone in which it is located, and you can set the time zone in the background. This is an international route.
I'm wondering if the entire system uses Greenwich Mean Time and converts it to local time based on the user's time zone.
For example, if a forum has users from China and the United States posting online at the same time, the system records the posting time as the world time.
I only catch one of the systems.\source\class\discuz\discuz_application.php
Class containstimezone_set()
Method@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
This setting$timeoffset
Actually, it's 0, that is, it's set Greenwich Mean Time ......
Who is familiar with dz source code? Give me some advice. Thank you!
Reply content:
On the Discuz user homepage, you can see the time zone in which it is located, and you can set the time zone in the background. This is an international route.
I'm wondering if the entire system uses Greenwich Mean Time and converts it to local time based on the user's time zone.
For example, if a forum has users from China and the United States posting online at the same time, the system records the posting time as the world time.
I only catch one of the systems.\source\class\discuz\discuz_application.php
Class containstimezone_set()
Method@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
This setting$timeoffset
Actually, it's 0, that is, it's set Greenwich Mean Time ......
Who is familiar with dz source code? Give me some advice. Thank you!
No matter how you set the time zone, the timestamp obtained by the time function is fixed and will not be different because of different time zones. It only works when you call the date function. You can understand it as follows, if you are in UTC + 8, date ('Y-m-d') is actually date ('Y-m-d', time () + 8*3600 ), so the so-called internationalization can do this, store the user's time zone, and then redefine a date formatting function, such
function localdate( $format, $time_zone ){ return date($format,time()+$time_zone*3600)}
Nobody knows?