PHP Time difference 8 hours Solution _php Tutorial

Source: Internet
Author: User
Tags time zones timezones
The initialization statement for adding time to the program: "Date_default_timezone_set (" Asia/shanghai ");

Definition and usage

The Date_default_timezone_set () function sets the default timezone used by all date/time functions.
The function of the Date_default_timezone_set () is to set the default time zone for all datetime functions in a script.

Syntax
Grammar

Date_default_timezone_set (TimeZone)

Parameter
Parameter
description
Describe
TimeZone Required. The timezone identifier, like "UTC" or "Europe/paris". List of valid timezones:http://www.php tutorials. net/manual/en/timezones.php
Necessary parameters, time zone confirmations, such as "UTC" or "Europe/paris". The valid time zones are listed below: http://www.php.net/manual/en/timezones.php

Tips Tutorials and Notes
Watch out.

Note: This function is always returns True (even if the timezone parameter isn ' t valid).
Note: This function always returns True (even if the time zone parameter is invalid).

Example
Case

     
     

The output of the code above would be:
The code above will output the following result:

http://www.bkjia.com/PHPjc/632328.html www.bkjia.com true http://www.bkjia.com/PHPjc/632328.html techarticle The initialization statement that adds time to the program: Date_default_timezone_set (Asia/shanghai); Define and use the Date_default_timezone_set () function sets the Default timezone used by all d ...

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