title: Magento custom module date field saving date to one day before the selected date
body: <p>i followed steps on this link to add a date field to my custom module :</p>
  
  <p><a href="http://magentomechanic.blogspot.com/2010/01/to-add-custom-date-field-in-custom.html" rel="nofollow">http://magentomechanic.blogspot.com/2010/01/to-add-custom-date-field-in-custom.html</a></p>
  
  <p>Everything went fine, except for the that when i select a date and save configurations, it returns me date one day before the selected one :(</p>
  
  <p>For Example :</p>
  
  <p>When i select <strong>25 Feb</strong>, 2012 and save , it will save and return <strong>24 Feb</strong>, 2012.</p>
  
  <p>Notice it saved one day before :(</p>
  
  <p>i get this when i <strong>print_r($model)</strong> in admin controller before save:</p>
  
  <pre><code>[start_date] =&gt; 2012-01-24 16:00:00 // i set it to 25 but its saving 24
  [end_date] =&gt; 2012-01-26 16:00:00  // i set it to 27 but .....
  [status] =&gt; 1 [content] =&gt; asdasdadsd  
  [created_time] =&gt; 2012-01-25 07:27:11 // it gives current date and it is O'rite
  [update_time] =&gt; 2012-01-25 07:27:11 ) //it gives current date and it is O'rite
  </code></pre>
  
  <p><strong>NOTE:</strong></p>
  
  <p><strong>i echo the posted date and it was right what i set to mean there is no problem with the post data,
  mean client side is clear for any bug, so where the problem lies is when it is converted to save in database !!! Any help ???</strong></p>
  
  <p>Here is my <strong>initiall code</strong> i tried :</p>
  
  <pre><code>if($data['start_date'] != NULL )
                  {
                  $date = Mage::app()-&gt;getLocale()-&gt;date($data['start_date'], Zend_Date::DATE_SHORT);
                  $model-&gt;setStartDate($date-&gt;toString('YYYY-MM-dd HH:mm:ss'));
                  }
                  if($data['end_date'] != NULL)
                  {
                  $date1 = Mage::app()-&gt;getLocale()-&gt;date($data['end_date'], Zend_Date::DATE_SHORT);
                  $model-&gt;setEndDate($date1-&gt;toString('YYYY-MM-dd HH:mm:ss'));
                  }
  </code></pre>
  
  <p>then i tried this one :</p>
  
  <pre><code>echo $format = Mage::app()-&gt;getLocale()-&gt;getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT).'&lt;br/&gt;';
                  if($data['start_date'] != NULL )
                  {
                      echo $data['start_date']."&lt;br/&gt;"; // 01/27/12 correct date posted which i entered
                      $date = Mage::app()-&gt;getLocale()-&gt;date($data['start_date'], $format);
                      echo $date; /// Jan 26, 2012 4:00:00 PM but here we get back to one day
                      $time = $date-&gt;getTimestamp();
                      $model-&gt;setStartDate(Mage::getSingleton('core/date')-&gt;date(null, $time));
  
                      //$model-&gt;setStartDate($date-&gt;toString('YYYY-MM-dd HH:mm:ss'));
                  }
                  if($data['end_date'] != NULL)
                  {
                      echo $data['end_date'].'&lt;br/&gt;';
                      $date1 = Mage::app()-&gt;getLocale()-&gt;date($data['end_date'], $format);
  
                      $time = $date1-&gt;getTimestamp();
                      $model-&gt;setEndDate(Mage::getSingleton('core/date')-&gt;date(null, $time));
  
                      //$model-&gt;setEndDate($date1-&gt;toString('YYYY-MM-dd HH:mm:ss'));
                  }
  </code></pre>
  
  <p><strong>$format echoes : M/d/yy</strong>
  original posted date : 01/27/12
  $date echo result :Jan 26, 2012 4:00:00 PM</p>