PHP获取时间(昨天、明天)

获取明天时间

 public function get_last_date($num) {
        $tomorrow = mktime(0,0,0,date("m"),date("d")+$num,date("Y"));
        return date("Y-m-d", $tomorrow);
    }
echo  get_last_date(1);

获取昨天时间

 public function get_last_date($num) {
        $tomorrow = mktime(0,0,0,date("m"),date("d")-$num,date("Y"));
        return date("Y-m-d", $tomorrow);
    }
echo  get_last_date(1);


猜你喜欢

转载自blog.csdn.net/qq_41718455/article/details/80929851