I am trying to log the time difference in a mysql-field and when I try on screen the values are correct. After submitting the field to the database the field is empty. Where do I go wrong? The field is declared in mysql as timestamp and format current_timestamp. The code:
$strStart = date("Y-m-d H:i:s");
sleep(5);
$strEnd = date("Y-m-d H:i:s");
$dteStart = new DateTime($strStart);
$dteEnd = new DateTime($strEnd);
$dteDiff = $dteStart->diff($dteEnd);
//$calc = $dteDiff->format("YYYY-%M-%D %H:%I:%S");
$calc = $dteDiff->format("%Y%Y-%M-%D %H:%I:%S");
echo "Difference: " . $calc;
I am submitting the $calc to the db.