如何使用php以Y-M-D格式获得批结束日期

How do I get the end date in Y M D format when I have my batch start date as 01/03/2017 and total days as 56 days.

date('Y-m-d', mktime( 0, 0, 0, 1, $days));

I tried this,Here the days as my total days.But it is not working. please help some one

Try this

$date = date("Y-m-d", strtotime("01/03/2017"));
echo date('Y-m-d', strtotime('+56 days', strtotime($date)));

You can do this very easy by strtotime:

$start_date = '01/03/2017';
echo date('Y-m-d', strtotime($start_date + ' +' . $days . ' days')); //$days after $start_date

Below is the code to change date format

   $originalDate = date_create("yourdate");
   $newDate =   date_format($originalDate,"Y/m/d");

U can refer below link also

https://www.w3schools.com/php/func_date_date_create.asp

If are having 2 inputs for date then u can use date_diff https://www.w3schools.com/php/func_date_date_diff.asp