php教程 php里獲取前一天的時(shí)間?
php里獲取前一天的時(shí)間?//獲得當(dāng)前時(shí)間 //date()格式化時(shí)間返回String類(lèi)型。 date("Y-m-d H:i:s")$current_date = date(’Y-m-d
php里獲取前一天的時(shí)間?
//獲得當(dāng)前時(shí)間
//date()格式化時(shí)間返回String類(lèi)型。 date("Y-m-d H:i:s")
$current_date = date(’Y-m-d’,time())
//根據(jù)當(dāng)前時(shí)間加一周后
$weekLater = date(’Y-m-d’,strtotime("$current_date 1 week"))
echo $weekLate
// 2009-05-26 加一天的日期
$tomorrow = date(’Y-m-d’,strtotime("2009-05-26 1 day"))
echo $tomorrow // 2009-05-27
也可以這樣 date("Y-m-d",strtotime("-1 day")) ;直接獲得前一天時(shí)間