PHP date processing function mktime () tutorial

Source: Internet
Author: User

PHP date processing function mktime () tutorial

Definition and usage
The date of the Unix timestamp returned by the mktime () function.

This timestamp contains the Unix time between seconds (January 1, 1970 00:00:00 GMT), and at the specified time.

Syntax

Mktime (hour, minute, second, month, day, year, is_dst)
  
Parameter Description
Hour
Optional. Hour
Minute (Optional) specify the minute
Second (Optional) specify the second.
Month (Optional) specify the numerical month.
Day (Optional) specify the day.
Year (Optional) specify the year. The valid range for year is on some systems between 1901 and 2038. However this limitation is overcome in PHP 5
Is_dst
Optional. Set this parameter to 1 if the time is in daylight saving time (DST), 0 if not, or-1 (default value) if it is unknown. If it is unknown, PHP tries to find itself (which may lead to unexpected results ). Note: this parameter is not recommended in PHP 5. Use the new processing function
  

Tips and instructions
Note: If the argument is invalid, the function returns false (-1 before PHP version 5.1 ).


--------------------------------------------------------------------------------

For example
The mktime () function is a useful date for arithmetic and verification. It will automatically calculate various inputs out of the correct value

<? Phpecho (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>"); echo (date ("M-d-Y", mktime )). "<br/>");?>
Output code
Jan-05-2002Feb-01-2002Jan-01-2001Jan-01-1999

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.