title: Cannot save php datetime in database
body: <p>I want to save a datetime from PHP into my database, but I cannot. The datetime value in the database is always set as <code>0000-00-00 00:00:00</code>. What am I doing wrong?</p>
  
  <p>My code:</p>
  
  <pre><code>$today = new DateTime();
  $dt = $today-&gt;format('Y-m-d H:i:s');
  $sql = "UPDATE wp_posts SET  post_date = $dt, post_date_gmt = $dt WHERE ID = $id";
  </code></pre>