Who has a better understanding of the discuz, each user has their own time zone, the background can be set up, which realizes the internationalization AH

Source: Internet
Author: User
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?

  • 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.