PHP Time Processing

Source: Internet
Author: User

Introduction: This is a detailed page on PHP time processing. It introduces the related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 332638 'rolling = 'no'>
(1) print the timestamp strtotime ("+ 1 day") at this time tomorrow.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Time specified: Echo date ("Y-m-d h: I: s", strtotime ("+ 1 day") Result: 09:40:25

(2) print the timestamp strtotime ("-1 day") at this time yesterday.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Time specified: Echo date ("Y-m-d h: I: s", strtotime ("-1 day") Result: 09:40:25

(3) print the timestamp strtotime ("+ 1 week") for the next week.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Time specified: Echo date ("Y-m-d h: I: s", strtotime ("+ 1 week") Result: 09:40:25

(4) print the timestamp strtotime ("-1 week") for the last week.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Time specified: Echo date ("Y-m-d h: I: s", strtotime ("-1 week") Result: 09:40:25

(5) print the specified timestamp strtotime ("next Thursday") for the next week.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Time specified: Echo date ("Y-m-d h: I: s", strtotime ("next Thursday") Result: 00:00:00

(6) print the timestamp strtotime ("last Thursday") of the specified last week.

Current Time: Echo date ("y-m-d h: I: S", time () Result: 09:40:25

Specified Time: Echo date ("Y-m-d h: I: s", strtotime ("last Thursday") Result: 00:00:00

The preceding example shows that strtotime can parse the datetime description of any English text into a Unix timestamp. We can use mktime () or date () to format the datetime to get the specified timestamp, the date and time required for implementation.

These are the specific concepts of the PHP strtotime function.

More articles on "processing PHP time"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/332638.html pageno: 11.

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.