OK I'll give a brief explanation of each line, to hopefully make it a bit clearer.
the first line is an if statement that causes the code to only execute if there is a form post:
if($_SERVER['REQUEST_METHOD'] == "POST") {
the next line creates a loop using the foreach() construct that goes through each form element, it breaks the form element name into a variable named $k and the element value into a variable named $v:
foreach($_POST as $k => $v) {
the next line is really 2 lines, the first part looks at the element name which is stored in the $k variable, it takes the first 11 characters of the element name to see if it is equal to "DateAdded2_" using the substr() function:
if(substr($k, 0, 11) == "DateAdded2_")
if it is equal to "DateAdded2_", it performs the date format to reformat the using the Y-m-d h:m:s format that is expected by the MySQL database
$_POST[$k] = date("Y-m-d h:m:s", strtotime($_POST[$k]));