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

后端 未结 10 1727
一整个雨季
一整个雨季 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

    find out what the date was 5 days ago from today in php

    $date = strtotime(date("Y-m-d", strtotime("-5 day")));
    

    find out what the date was n days ago from today in php

    $date = strtotime(date("Y-m-d", strtotime("-n day")));
    

提交回复
热议问题