根据当前时间加减
date("Y-m-d",strtotime("-15 day",strtotime('2011-02-22')));
date("Y-m-d",strtotime("-15 day"));
date('Y-m-d H:i:s',time());
#根据指定时间加减
This function DOES NOT work from left-to-right as one would think.
This function parses the string as a whole,
then applies the intervals by size (year, month, ...).
Take the following example:
<?php
$Date = strtotime('2011-02-22');
// February 22nd, 2011. 28 days in this month, 29 next year.
echo date('n/j/Y', strtotime('+1 year, +7 days', $Date));
// add 1 year and 7 days. prints 2/29/2012
echo "<br />";
echo date('n/j/Y', strtotime('+7 days, +1 year', $Date));
// add 7 days and 1 year, but this also prints 2/29/2012
echo "<br />";
echo date('n/j/Y', strtotime('+1 year', strtotime('+7 days', $Date)));
// this prints 3/1/2012, what the 2nd would do if it was left-to-right
?>