PHP 獲取當天 凌晨 時間戳常用代碼


echo strtotime(date('Y-m-d'));
 
獲取明天凌晨的時間戳
代碼:echo strtotime(date('Y-m-d',strtotime('+1 day')));
 
附上測試代碼:
echo strtotime('2012-11-2');
echo strtotime('2012-11-2 00:00:00');
echo strtotime(date('Y-m-d')),'
';
echo date('Y-m-d H:i:s',strtotime(date('Y-m-d')));
echo strtotime(date('Y-m-d',strtotime('+1 day')));
echo ( strtotime(date('Y-m-d',strtotime('+1 day'))) - strtotime(date('Y-m-d')) )/3600;
 
其它參考代碼:
 
echo "一周后:".date("Y-m-d",strtotime("+1 week"));     
echo "一周零兩天四小時兩秒后:".date("Y-m-d G:H:s",strtotime("+1 week 2 days 4 hours 2 seconds"));     
echo "下個星期四:".date("Y-m-d",strtotime("next Thursday"));     
echo "上個周一:".date("Y-m-d",strtotime("last Monday"));     
echo "一個月前:".date("Y-m-d",strtotime("last month"));     
echo "一個月后:".date("Y-m-d",strtotime("+1 month"));     
echo "十年后:".date("Y-m-d",strtotime("+10 year"));    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM