Specific as follows:
1> as we know the start time, to add a time, to arrive at a result time, you can use the following code
$time 1 = ' 2008-10-1 12:30:30 ';
echo Date (' y-m-d h:i:s ', Strtotime ($time 1) +30*60);//Note the case in quotation marks, minute is I not M
Execution Result: 2008-10-01 13:00:30
2> if we want to calculate the difference of two time, we can use the following methods:
$time 1 = ' 2008-10-1 12:30:30 ';
$time 2 = ' 2008-10-1 13:45:30 ';
$diff = (Strtotime ($time 2)-strtotime ($time 1))/60;
echo $time 1. ' To '. $time 2. ' Time difference '. $diff. ' Minutes ';
Execution Result: 2008-10-1 12:30:30 to 2008-10-1 13:45:30 time difference 75 minutes
Summary: The basis of PHP time calculation is the second, grasp the law can be converted into minutes, hours, etc. can be, so that time calculation becomes very simple and easy.
http://www.bkjia.com/PHPjc/319850.html www.bkjia.com true http://www.bkjia.com/PHPjc/319850.html techarticle As follows: 1 if we know the start time, to add a time, to arrive at a result time, you can use the following code $time 1= ' 2008-10-1 12:30:30 '; Echo date (' y-m-d h:i:s ', Strtotime ($time 1 ...