Recently, due to the project requirements to do a statistical function, statistics before the current date of the first 30 days of records. function is very simple, the following will be the implementation of the method and everyone to share, convenient for the needs of friends.
In fact, the main use of PHP strtotime this function, Strtotime (' N Day '), the example is as follows:
$days =array ();
for ($i =0; $i <=7; $i + +) {//Here numbers vary according to needs
$days []=date ("y-m-d", Strtotime ('-'. $i. ' Day '));
}//http://www.alixixi.com/php-function/970.html
Echo '
';p rint_r ($days);
The results will appear as follows:
Array
(
[0] = 2014-03-21
[1] = 2014-03-20
[2] = 2014-03-19
[3] = 2014-03-18
[4] = 2014-03-17
[5] = 2014-03-16
[6] = 2014-03-15
[7] = 2014-03-14
)
http://www.bkjia.com/PHPjc/814684.html www.bkjia.com true http://www.bkjia.com/PHPjc/814684.html techarticle recently, due to the project requirements to do a statistical function, statistics before the current date of the first 30 days of records. function is very simple, the following will be the implementation of the method and everyone to share a bit, convenient to have the need ...