I have a script
idea_slug=$_POST['idea_slug'];
$data['idea_date']=$this->db->query("SELECT * FROM td_idea WHERE idea_slug='$idea_slug'")->result_array();
$submit_date=$data['idea_date'][0]['idea_submit_date'];
$datetime1 = DateTime::createFromFormat('d/m/Y', $submit_date);
$submit_date= $datetime1->format('Y-m-d');
$submit_date = strtotime($submit_date);
$end = strtotime('+90 days', $submit_date);
now i want to convert $end to Y/m/d format how can i do so??
Like this :
echo date('Y/m/d', $end);
The DateTime "alternative" to strtotime() is modify().
You can do like following
$date_format = date('Y/m/d', $end);
$datetime1 = DateTime::createFromFormat('d/m/Y', $submit_date);
$end = clone $datetime1;
$end->add(new DateInterval('P90D'));
echo $end->format('Y/m/d');
It's simpel =), you should check the DateTime class
$datetime1 = DateTime::createFromFormat('d/m/Y', $submit_date);
$datetime1->modify('+90 day');
$end = $datetime1->format('d/m/Y');
http://php.net/manual/en/datetime.modify.php
http://www.php.net/manual/en/datetime.format.php
Cheers