Php uses date to format the output time of a specified category

Source: Internet
Author: User
Php uses the date format to output the specified range of time requirements during log analysis today, because the logs are separated by days, I need to traverse the logs for 30 days, if the class is obtained & #20284; an array suffix such as 20130101-20130131. I wrote a small program to implement it. here I will record it, mainly using the php implementation code of the date function and the strtotime function & lt; php uses date to format the output time in the specified range
To perform log analysis today, because logs are separated by days, I need to traverse logs for 30 days. what if I get an array suffix like 20130101-20130131, I wrote a small program to implement it. here I will record it, mainly the application of the date function and the strtotime function.
Php implementation code
 

Effect


The date function obtains the php code for the date of the previous day or the next day.
// Date definition $ day = date ("Ymd", strtotime ("-1 day"); echo $ day. "\ n"; $ day = date ("Ymd", strtotime ("+ 1 day"); echo $ day. "\ n ";

Effect

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.