Php date difference 8 small time solution _ PHP Tutorial

Source: Internet
Author: User
Tags time zones timezones
Php date difference 8 small time solution. Initialization statement for adding time to the program: date_default_timezone_set (asiashanghai); definition and usage of the initialization statement for adding time to the prepare () 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 date_default_timezone_set () function is used to set the default time zone for all date and time functions in a script.

Syntax
Syntax

date_default_timezone_set(timezone)

Parameter
Parameters
Description
Description
Timezone Required. the timezone identifier, like "utc" or "europe/paris". list of valid timezones: http://www.php tutorial. net/manual/en/timezones. php
Required parameter, such as utc or europe/paris ". The following lists valid time zones: http://www.php.net/manual/en/timezones.php

Tips tutorial and notes
Notes

Note:This function 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 will be:
The above code will output the following results:

Define (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.