Question 1: problems related to the time () method

Source: Internet
Author: User
Tags echo date
Question 1: Is time () always the timestamp of the current time zone obtained by time? Whether or not the time zone is set. PHPcode // I wrote two test pages. The two pages get the same value: //. php: echotime (); // B. phpdate_defa
1. is time () always the timestamp of the current time zone? Whether or not the time zone is set.
PHP code
  // I wrote two test pages. The two pages get the same value: //. php: echo time (); // B. phpdate_default_timezone_set ('prc'); echo time ();


2. at which time does the time () method obtain the timestamp?
For example, in WINDOWS, do I refer to WINDOWS Time in the toolbar? Then subtract 8*60*60?
In Linux, does it refer to the hardware clock or the software clock?

3. does php4 not support time zone setting?
Our unit server is configured with php4, and then directly "echo date ('Y-m-d H: I: s');" without setting the time zone ');", the output is also the correct Chinese time.

Thank you!

------ Solution --------------------
Of course.
I took a closer look at your original question.
Echo time ();
Date_default_timezone_set ('prc ');
Echo time ();
If the output result is the same, do you have any questions?
There is a conflict in my #1 reply. time always gets Greenwich Mean time.
The date function is related to the time zone.

Echo date ('Y-m-d H: I: s ');
Date_default_timezone_set ('prc ');
Echo date ('Y-m-d H: I: s ');

We can see the difference.

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.