PHP程序中时间戳,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"));
總結
以上是生活随笔為你收集整理的PHP程序中时间戳,php 时间戳常用代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信小程序模仿开眼视频app(一)——视
- 下一篇: url去除掉一个参数php,php怎样去