我的sql数据库中没有插入日期和时间

I am inserting datetime object in mysql database, query does not execute. ie no insertion takes place. where as data type of current_time and expiry_time in db is datetime. here is my code. kindly specify my mistake. i shall be very thankful.

if($timespan == '3 days') {$expiry_time = date('Y-m-d H:i:s', strtotime('+3 days'));}
if($timespan == '5 days') {$expiry_time = date('Y-m-d H:i:s', strtotime('+5 days'));}
if($timespan == '7 days') {$expiry_time = date('Y-m-d H:i:s', strtotime('+7 days'));}

$dt = new DateTime();
$dt->format('Y-m-d H:i:s');
$dt = serialize($dt);
$sql="INSERT INTO survey (user, title, description, opta, optb,optc,optd,uploaded,current_time,expiry_time) VALUES ('$user','$title', '$dis', '$a' , '$b', '$c', '$d','','$dt','$expiry_time')";
if (mysqli_query($con,$sql))
 {
  echo "Success";
 }
 else
  {
  echo "Error: " . mysql_error();
  }

Because $dt->format('Y-m-d H:i:s'); returns a string and does not convert the $dt DateTime object to a string. Save the output of $dt->format('Y-m-d H:i:s'); to a variable and insert that.

you can use mysql NOW()

$sql="INSERT INTO survey (user, title, description, opta, optb,optc,optd,uploaded,current_time,expiry_time) VALUES ('$user','$title', '$dis', '$a' , '$b', '$c', '$d','',NOW(),'$expiry_time')";