increment date by one month

前端 未结 18 2522
广开言路
广开言路 2020-11-27 04:14

Let\'s say I have a date in the following format: 2010-12-11 (year-mon-day)

With PHP, I want to increment the date by one month, and I want the year to be automatica

18条回答
  •  甜味超标
    2020-11-27 04:47

    For anyone looking for an answer to any date format.

    echo date_create_from_format('d/m/Y', '15/04/2017')->add(new DateInterval('P1M'))->format('d/m/Y');
    

    Just change the date format.

提交回复
热议问题