Home > Backend Development > PHP Tutorial > PHP uses date format to output a specified range of time_PHP tutorial

PHP uses date format to output a specified range of time_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-14 10:08:14
Original
1078 people have browsed it

need

When doing log analysis today, since the logs are divided by day, I need to traverse 30 days of logs. If I get an array suffix like 20130101-20130131, I wrote a small program to implement it. I will record it here. Mainly the application of date function and strtotime function
php implementation code
[php]
$stand = "2013-01-";
for ($i = 1; $i <= 31; $i ++) {
$time = strtotime($stand . $i);
$date[] = date("Ymd", $time);
}
print_r($date);
?>
Achieve results
PHP uses date format to output a specified range of time_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477789.htmlTechArticleWhen I need to do log analysis today, since the logs are divided by day, I need to traverse 30 days of logs. If To get an array suffix like 20130101-20130131, I wrote a small program to achieve it...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template