Q:

Changing the datetime format in php

Here is the format
'd-m-Y H:i:s'(15-11-2008  7:16:09)

I want to change to this format
'Y-m-d H:i:s' (2008-11-15 07:16:09)

Tried the strtotime() function, but it takes the 'm' as 'd' and 'd' as 'm'
Help! new to php..
Current code`           
$dt = strtotime($this->input->post('insert_dts'));
$formated_date_time = date("Y-m-d H:i:s",$dt);`

A:

As per your code :     
$dt = strtotime('15-11-2008 7:16:09');
echo $formated_date_time = date("Y-m-d H:i:s",$dt);

Output : 
2008-11-15 07:16:09

