Who knows about Discuz? Every user has his own time zone and can set it in the background.

Source: Internet
Author: User
Tags time zones
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.phpClass containstimezone_set()Method@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));This setting$timeoffsetActually, 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.phpClass containstimezone_set()Method@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));This setting$timeoffsetActually, 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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.