How to subtract 4 months from today's date?

后端 未结 2 1066
北恋
北恋 2021-01-01 13:34

I need to declare two dates in \"Ymd\" format: $toDate and $fromDate.

$toDate represents today\'s date and

2条回答
  •  [愿得一人]
    2021-01-01 14:03

    see the code below...

    $fourmonthsback = date("Ymd", mktime(0, 0, 0, date("m")-4, date("d"),   date("Y")));
    

    OR

    $fourmonthsback = mktime(0, 0, 0, date("m")-4, date("d"),   date("Y"));
    

提交回复
热议问题