登 录
可以利用 strtotime() 函數將字串資料轉為 timestamp,再進行計算。 <?php $atime="2008-06-24 09:15:42"; $btime="2008-06-23 08:00:05"; echo (strtotime($atime) - strtotime($btime)); //計算相差幾秒 echo (strtotime($atime) - strtotime($btime))/3600; //計算相差幾小時 ?>
抱歉!评论已关闭.