PHP not adding days in date -
php:
$date = str_replace('/', '-', $this->input->post('insert_date')); $data['insert_date'] = date('y-m-d', strtotime($date)); $data['credit_limit'] = date($data['insert_date'], strtotime("+10 days")); echo $data['insert_date'].'<br>'; echo $data['credit_limit'].'<br>';
output:
2017-09-01 2017-09-01
expected output:
2017-09-01 2017-09-11
anyone can please me why $data['credit_limit'] != 2017-09-11. why 10 days not added in $data['credit_limit'] how can resolve issue? please me.
your format strtotime
wrong:
$data['credit_limit'] = date('y-m-d', strtotime($data['insert_date'] . " +10 days"));
explanation:
you need add date inside strtotime
function. date
function holds format first parameter this: date($format)
.
Comments
Post a Comment