suppose $arr7 contains this value '10/5/2007 6:02' how can i format that to be change like this '2007-01-22 08:55:19' when im going to use it in a insert statement here's the code $sql = "INSERT INTO Links(URL,Title,Description,Email,SubmitURL,ContactedOn) VALUES('{$arr[0]}','{$arr[1]}','{$arr[2]}','{$arr[3]}','{$arr[4]}','{$arr[7]}')" original value format = 10/5/2007 6:02 target value format before storing to sql = 2007-01-22 08:55:19
Your original date does not contain seconds, so in the new one it'll always be 00. $old = '10/5/2007 6:02'; $new = date('Y-m-d H:i:s', strtotime($old)); echo $new; PHP: