get last 3 months from current month using php

后端 未结 4 1041
[愿得一人]
[愿得一人] 2021-01-27 19:58

I want to get last 3 months name from current month. For example current month is August. So, I want the datas like these June, July, August. I have tried this code echo d

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-27 21:02

    Simple code:

    =0;$x--){
    echo date('F', strtotime(date('Y-m')." -" . $x . " month"));
    echo "
    "; } ?>

    Got the idea from LTroubs here.

提交回复
热议问题