【发布时间】:2016-01-25 17:08:39
【问题描述】:
我有一个数字,我想增加日期的月份,所以如果日期是 2016-01-01 将返回 2016-04-01
$month = 3;
$date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('date'))));
【问题讨论】:
标签: php codeigniter date
我有一个数字,我想增加日期的月份,所以如果日期是 2016-01-01 将返回 2016-04-01
$month = 3;
$date = date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post('date'))));
【问题讨论】:
标签: php codeigniter date
未经测试,但您可以执行以下操作:
$month = 3;
$newdate = date('Y-m-d', strtotime("+".$month." months", str_replace('/', '-', $this->input->post('date'))));
【讨论】:
您可以使用以下方法在给定日期添加三个月:
$Date = date('Y-m-d', strtotime("+3 months", strtotime(str_replace('/','-', $this->input->post('date') ))));
【讨论】: