PHP implementation for the date, month, days, weeks, hours, minutes, seconds and other methods of adding and subtraction operations

Source: Internet
Author: User
This article mainly introduces the implementation of PHP for the date, month, days, weeks, hours, minutes, seconds, such as the addition and subtraction, combined with examples of the form of a simple date-time algorithm based on strtotime, very practical value, the need for friends can refer to the next

This is actually strtotime the built-in function


PHP date plus minus week date ("Y-m-d", Strtotime ("2013-11-12 +1 Week"))//php date plus minus days ("y-m-d", Strtotime ("2013-11-12 12:12:12 +1 da Y "))//php date plus minus hour date (" Y-m-d h:i:s ", Strtotime (" 2013-11-12 12:12:12 +1 Hour "))//php date plus minus number of months date (" y-m-d ", Strtotime (" 2013-11-12 12:12:12 +1 Month "))//php date plus minus point date (" Y-m-d h:i:s ", Strtotime (" 2013-11-12 12:12:12 +1 Minute "))//php date plus minus seconds dat E ("y-m-d h:i:s", Strtotime ("2013-11-12 12:12:12 +1 Second"))


The above is the whole content of this article, I hope that everyone's study has helped.


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.