How to find out what the date was 5 days ago?

后端 未结 10 1698
一整个雨季
一整个雨季 2020-12-24 04:46

Well, the following returns what date was 5 days ago:

$days_ago = date(\'Y-m-d\', mktime(0, 0, 0, date(\"m\") , date(\"d\") - 5, date(\"Y\")));
10条回答
  •  独厮守ぢ
    2020-12-24 05:23

    I think a readable way of doing that is:

    $days_ago = date('Y-m-d', strtotime('-5 days', strtotime('2008-12-02')));
    

提交回复
热议问题