The following code is some of the most commonly used date processing functions, can be two times the date plus and minus, the difference between the two dates, date conversion time cut.
echo Date (' y-m-d ', Strtotime (' +1 d ', strtotime (' 2009-07-08 '))//Date days Add function
echo Date ("y-m-d", ' 1246982400 ');
Echo ' <br> ';
echo Date ("y-m-d", ' 1279123200 ');
Die ();
$d = "2009-07-08 10:19:00";
echo Date ("Y-m-d", Strtotime ("$d +1 Day")); Date days Add function
function Datetotime ($d)//convert date to time heap cut
{
$year = ((int) substr ("$d", 0,4))//year
$month = ((int) substr ("$d", 5,2))//Get Month
$day = ((int) substr ("$d", 8,2))/date
Return Mktime (0,0,0, $month, $day, $year);
}
/*
The following function calculates the two dates
*/
$Date _1= "2009-07-08";
echo $Date _1+1;
$Date _2= "2009-06-08";
$Date _list_a1=explode ("-", $Date _1);
$Date _list_a2=explode ("-", $Date _2);
$d 1=mktime (0,0,0, $Date _list_a1[1], $Date _list_a1[2], $Date _list_a1[0]);
$d 2=mktime (0,0,0, $Date _list_a2[1], $Date _list_a2[2], $Date _list_a2[0]);
$Days =round (($d 1-$d 2)/3600/24);
echo "Two dates before the difference between $days days";
Original site reproduced annotated from the www.111cn.net/phper/php.html