php mktime Calculate the difference between two time

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags difference network network programming php php tutorial programming set set to

mktime = mktime ($ hours, minute, seconds, month, day, years)

$ start_time = mktime (0,0,0,01,09,2010); // start time

$ end_time = mktime (0,0,0,02,09,2010); // end time

$ times = $ end_time- $ start_time; //

How many seconds between beginning and end 6

$ now_time = $ times / (24 * 3600); / / draw a total of how much

The mktime () function returns a unix time stamp of the date.

The parameter always represents the gmt date, so is_dst has no effect on the result.

Arguments can be left blank from right to left, and empty parameters set to the corresponding current gmt value.

mktime (hour, minute, second, month, day, year, is_dst) Parameter description
hour optional. Prescribed hours.
minute optional. Prescribed minutes.
second optional. Prescribed seconds.
month optional. Specify the number of months.
day optional. Prescribed days.
year optional. Prescribed year. On some systems, the legal value is between 1901-2038. However, in PHP Tutorial 5 there is no such limitation.
is_dst Optional. Set to 1 if the time is during Daylight Saving Time (dst), set to 0 otherwise, and set to -1 if unknown.

As of 5.1.0, the is_dst parameter is deprecated. So you should use the new time zone handling features.

Related Article

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