Date_default_timezone_set () sets the time zone,

Source: Internet
Author: User

Date_default_timezone_set () sets the time zone,

Date_default_timezone_set () sets the time zone

<? Php
Echo function_exists (date_default_timezone_set). "<br>"; // here, he always returns 1. This function is used to determine whether the character here is a defined function name.
Echo date ('Y-m-d H: I: s'). "<br>"; // Default Time Zone

Echo date_default_timezone_set ("Etc/GMT"). "<br>"; // This is the Greenwich Mean Time. The obtained time is the same as the default time zone.
Echo date ('Y-m-d H: I: s'). "<br> ";

Echo date_default_timezone_set ("Etc/GMT + 8"). "<br>"; // This is 8 hours slower than the standard time of linwei governance
Echo date ('Y-m-d H: I: s'). "<br> ";

Echo date_default_timezone_set ("Etc/GMT-8"). "<br>"; // The Last One cannot be imagined, we get 8 hours faster than that, so we get 8 fewer
Echo date ('Y-m-d H: I: s'). "<br> ";

Echo date_default_timezone_set ('prc'). "<br>"; // set the China Time Zone
Echo date ('Y-m-d H: I: s'). "<br>"; // Chinese Standard Time
?>

// Output
1
02:20:42 // Default Time Zone
1
02:20:42 // ("Etc/GMT") Greenwich Mean Time
1
18:20:42 // ("Etc/GMT + 8") 8 hours slower than the standard time of linwei governance
1
10:20:42 // ("Etc/GMT-8") 8 hours faster than the standard time of Lin Weizhi, is our Beijing Time
1
10:20:42 // ('prc') China Standard Time
Below

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.