PHP mktime () function

Source: Internet
Author: User

PHP provides a very useful function mktime ().
You simply send the order to Mktime () the hour, minute, number of seconds, month, date, and year that you wish to represent,
Mktime () returns the total number of seconds that date has been since January 1, 1970.
Get the total number of seconds from January 1, 2000 to 1970.1.1
$y 2k = mktime (0,0,0,1,1,2000);

Note: The era of Unix time is January 1, 1970. Have you ever thought about.??

Many programming languages originate from UNIX systems, and UNIX systems think January 1, 1970 0 O'Clock is the time era, so we often say that the Unix timestamp is January 1, 1970 0 o'clock as the starting time.

The first computer operating system is 32 bits, and the time is represented by 32 bits.

System.out.println (Integer.max_value);

2147483647

For example. The Integer is represented in Java in 32 bits, so the maximum value 32 bits can represent is 2147483647. Another 1 years the total number of seconds for 365 days is 31536000,2147483647/31536000 = 68.1, that is, 32 can be expressed as the longest time is 68, starting from 1970, Plus 68.1, the actual final to January 19, 2038 03:14 07 seconds, will reach the maximum time, over this point in time, all 32-bit operating system time will become 10000000 00000000 00000000 00000000, it is December 13, 1901 20:45 52 seconds, so there will be time to return to the phenomenon, a lot of software will run the exception.

Here, I think the answer to the question has been revealed, that is: because the maximum interval of 32 bits to represent the time is 68, and the earliest Unix operating system takes into account the age of the computer generation and the time frame of the application to take the January 1, 1970 as the time of the Unix era (start time), As for the phenomenon of time regression, I believe that with the 64 of the operating system is gradually resolved, because 64-bit operating system can be represented to 292,277,026,596 December 4 15:30 08 seconds, believe that our generation of n generations, even if the day of the destruction of the earth will not worry enough, Because this time is hundreds of years later.

PHP mktime () function

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.