PHP的strtotime() 函數用法,7日內顯示New小圖示語法
2010年1月19日
尚無評論
PHP的strtotime() 函數可以將字串資料轉為 timestamp,再進行計算
如
<?php $atime="2010-01-19 08:00:00"; $btime="2010-01-18 08:00:00"; echo (strtotime($atime) - strtotime($btime)); //計算相差幾秒 echo (strtotime($atime) - strtotime($btime))/3600; //計算相差幾小時 echo (strtotime($atime) - strtotime($btime))/86400; //計算相差幾天 ?>
如要7天內文章顯示New Icon語法如下:

最新留言