Return to default time zone setting default time zone

Source: Internet
Author: User
Tags php tutorial

Return to default time zone setting default time zone

PHP Date_default_timezone_get () function
PHP date/time function
Definitions and usage
The Date_default_timezone_get () function returns the default time zone used by all date-time functions in the script.

Grammar
Date_default_timezone_get (void) parameter description
void Optional.

Description
This function returns the default time zone, using the following "assumed" order:

Time zone set with the Date_default_timezone_set () function (if set)
TZ environment variable (if not null)
Date.timezone configuration options (if set)
Speculate on your own (if the operating system supports)
Return UTC If none of the above selections are successful
Example
<?php Tutorial
Echo (Date_default_timezone_get ());
?> output:

Europe/paris


PHP Date_default_timezone_set () function
PHP date/time function
Definitions and usage
The Date_default_timezone_set () function sets the default time zone for all date/time functions in the script.

Grammar
Date_default_timezone_set (timezone) parameter description
TimeZone required. The time zone identifier, such as "UTC" or "Europe/paris".

Description
Note: Since PHP 5.1.0 (This version of the date time function is rewritten), if the time zone is not correct each call to a datetime function generates a E_notice level error message, and e_strict level information is generated if you use system settings or TZ environment variables.
Example
<?php
Echo (Date_default_timezone_set ("Europe/paris"));
?> output:

1

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.