/**
*
* 获取给定日期的前一天
* @param string $date
* @return string $yesterday
*/
public function getYesterday($date)
{
if(empty($date))
{
$yesterday = date("Y-m-d",strtotime("-1 day"));
}else{
$arr = explode('-', $date);
$year = $arr[0];
$month = $arr[1];
$day = $arr[2];
$unixtime = mktime(0,0,0,$month,$day,$year)-86400;
$yesterday = date('Y-m-d',$unixtime);
}
return $yesterday;
}
php 获取给定日期的前一天日期
最新推荐文章于 2023-01-01 23:46:43 发布