title: wrong date being inserted into mysql using php
body: <p>I am using a form an php to capture a date, convert it to unixtime, then insert it into mysql. The problem is, when I try to insert Jan. 1, 2012, what gets inserted is Dec. 31, 2011. This must be a simple problem, but I could use some help.</p>
  
  <p>Here's my form code:</p>
  
  <pre><code>&lt;select name="mo"&gt;
     &lt;?php 
     $arrMo = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
     foreach ($arrMo as $key =&gt; $value) {
         $option_val = intval($key) + 1;
      echo "&lt;option value='" . $option_val . "'&gt;" . $value . "&lt;/option&gt;"; 
  }
  
     ?&gt;
     &lt;/select&gt;  / 
  
     &lt;select name="day"&gt;
     &lt;?php 
     for ($b = 1; $b &lt; 32; $b++) {
         echo "&lt;option value='" . $b . "'&gt;" . $b . "&lt;/option&gt;\n";
     }
     ?&gt;
     &lt;/select&gt;  / 
     &lt;select name="year"&gt;
     &lt;?php $thisyear = date("Y");
     $thisyear = intval($thisyear);
     for ($c = 0; $c &lt; 6; $c++) {
         $newval = $thisyear - intval($c);
         echo "&lt;option value='" . $newval . "'&gt;" . $newval . "&lt;/option&gt;\n";
     }
  
     ?&gt;
     &lt;/select&gt;
  </code></pre>
  
  <p>Then I alter it in php:</p>
  
  <pre><code>$timestamp =  $_POST['year'] . "-" .  $_POST['mo'] . "-" . $_POST['day'];
  $timestamp = strtotime("Y-m-d H:i:s", $timestamp);//turn it into Unix time
  $mysqldatetime = date("Y-m-d H:i:s", $timestamp);
  </code></pre>
  
  <p>Then I try to insert it into the database:</p>
  
  <pre><code>$q_location = "Insert into markers(MarkerID, lat, lng, street, neighborhood, date) values(" . $nextLocation . ", '" . $_POST['latitude'] . "', '" . $_POST['longitude'] . "', '" . addslashes($_POST['address_public']) . "', '" .   addslashes($_POST['neighborhood']) . "', FROM_UNIXTIME(" . $mysqldatetime . "))";
  </code></pre>
  
  <p>Any idea what I'm doing wrong, please?</p>