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 ;? $ Stand & quot; 2013-01-& php format the time in the specified range with date
Requirement
During 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