PHP timestamp function

Source: Internet
Author: User

1.mktime

Mktime ($hour = null, $minute = NULL, $second = NULL, $month = NULL, $day = NULL, $year = NULL, $is _DST = null)

Hour, minute, number of seconds, month, day, year mktime (' 17 ', ' 23 ', ' 35 ');

2.strtotime

Strtotime (Time,now)

Parameters Description
Time Specifies the time string to parse.
Now The timestamp used to calculate the return value. If this argument is omitted, the current time is used.

<?phpecho (Strtotime ("Now"));      Now the Time Echo (Strtotime ("3 October 2005"));     October 3, 2005 Echo (Strtotime ("+5 hours"));           Add five hours of Echo (Strtotime ("+1 Week"));           Plus one week Echo (Strtotime ("+1 Week 3 days 7 hours 5 Seconds"));     Plus one week Three days seven hours Five seconds Echo (Strtotime ("Next Monday"));         Next Monday Echo (Strtotime ("Last Sunday"));         Last Sunday?>

Output:

1138614504112829040011386325041139219304113950370911391804001138489200

PHP timestamp 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.