title: PHP date insert
body: <p>I have a script what insert a date from the value of a input:</p>
  
  <p>PHP:</p>
  
  <pre><code>&lt;input type="text" id="datepicker" name="expire" placeholder="dd-mm-yyyy" value="&lt;?php echo (DateTime::createFromFormat('d-m-Y', date("d-m-Y"))-&gt;modify('+1 day')-&gt;format('d-m-Y')); ?&gt;" /&gt; 
  </code></pre>
  
  <p>You can also edit the date by a date picker!</p>
  
  <p><a href="https://i.stack.imgur.com/mHh7h.png" rel="nofollow noreferrer">The datepicker</a></p>
  
  <p>But when I insert it to the database with this query:</p>
  
  <pre><code>$mysql-&gt;query("INSERT INTO code(code, file_match, file_size, expire, ip, can_used) 
  VALUES ('".$mysql-&gt;real_escape_string($_POST['code'])."',
  '".$mysql-&gt;real_escape_string($_POST['bestand'])."', 
  '".filesize('./Hier_je_files/'.$mysql-&gt;real_escape_string($_POST['bestand']))."', 
  '".time($mysql-&gt;real_escape_string($_POST['expire']))."',
  '".$mysql-&gt;real_escape_string($_POST['ip_whitelist'])."', 
  '".$mysql-&gt;real_escape_string($_POST['used'])."')"
  </code></pre>
  
  <p>And then echo it with this:</p>
  
  <pre><code>&lt;?php echo date('d-m-Y H:i:s', $info['expire']); ?&gt;
  </code></pre>
  
  <p>Output is always the date of to day:</p>
  
  <p><img src="https://i.stack.imgur.com/GZmMh.png" alt="output"></p>
  
  <p>Database:</p>
  
  <p><img src="https://i.stack.imgur.com/8cYDh.png" alt="database"></p>
  
  <p>I dont know why, and how to fix it. </p>