title: Magento Admin Grid Date Format
body: <p>I'd like to be able to have a date/calendar selector in one of my admin grids when editing/adding an item.  How do I code a calendar-style format?</p>
  
  <p>I've tried changing the "format" parameter to "date" with no success.</p>
  
  <p>I will include code and snapshots for clarification.  Some of the code comes from the existing project, some comes from tutorials.  I don't feel like a master of this code by any means, so any suggestions are welcome.</p>
  
  <p>PHP 5.4.25 Magento 1.8.1.0</p>
  
  <p>The search section on my index seems to be working:</p>
  
  <p><a href="https://i.stack.imgur.com/FGwUF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FGwUF.png" alt="grid index"></a>
  </p>
  
  <p>But I'd like to change the text field for "close date" to a calendar-picker:</p>
  
  <p><a href="https://i.stack.imgur.com/l7j9E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l7j9E.png" alt="grid edit"></a>
  
  <a href="https://i.stack.imgur.com/Oy9jp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oy9jp.png" alt="grid add"></a>
  </p>
  
  <p>Here is my code for ../Party/Block/Adminhtml/Party/Edit/Tab/Form.php:</p>
  
  <p>
  
  <pre><code>class Foobar_Party_Block_Adminhtml_Party_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
  
  protected function _prepareForm() {
  
      $form = new Varien_Data_Form();
      $this-&gt;setForm($form);
      $fieldset = $form-&gt;addFieldset("party_form", array("legend" =&gt; Mage::helper("party")-&gt;__("Party information")));
  
      /* Code for other columns */
  
      $fieldset-&gt;addField("party_close_date", "date", array(
          "label" =&gt; Mage::helper("party")-&gt;__("Close Date"),
  
          'format' =&gt; 'date',
          'name' =&gt;   'party_close_date',
          'time' =&gt;   'true',
      ));
  
      if (Mage::getSingleton("adminhtml/session")-&gt;getPartyData()) {
          $form-&gt;setValues(Mage::getSingleton("adminhtml/session")-&gt;getPartyData());
          Mage::getSingleton("adminhtml/session")-&gt;setPartyData(null);
      } elseif (Mage::registry("party_data")) {
          $form-&gt;setValues(Mage::registry("party_data")-&gt;getData());
      }
      return parent::_prepareForm();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is my code for ../Party/Block/Adminhtml/Party/Edit/Form.php:</p>
  
  <pre><code>&lt;?php
  
  class Foobar_Party_Block_Adminhtml_Party_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
  
  protected function _prepareForm() {
      $form = new Varien_Data_Form(array(
          "id" =&gt; "edit_form",
          "action" =&gt; $this-&gt;getUrl("*/*/save", array("id" =&gt; $this-&gt;getRequest()-&gt;getParam("id"))),
          "method" =&gt; "post",
          "enctype" =&gt; "multipart/form-data",
              )
      );
      $form-&gt;setUseContainer(true);
      $this-&gt;setForm($form);
      return parent::_prepareForm();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is my code for ../Party/Block/Adminhtml/Party/Grid.php:</p>
  
  <pre><code>&lt;?php
  
  class Foobar_Party_Block_Adminhtml_Party_Grid extends Mage_Adminhtml_Block_Widget_Grid {
  
  public function __construct() {
      parent::__construct();
      $this-&gt;setId("partyGrid");
      $this-&gt;setDefaultDir("ASC");
      $this-&gt;setSaveParametersInSession(true);
  }
  
  protected function _prepareCollection() {
      $collection = Mage::getModel("party/party")-&gt;getCollection();
      $this-&gt;setCollection($collection);
      return parent::_prepareCollection();
  }
  
  protected function _prepareColumns() {
  
      /* Code for other columns */
  
      $this-&gt;addColumn("party_close_date", array(
          "header" =&gt; Mage::helper("party")-&gt;__("Close Date"),
          "type" =&gt;   "datetime", 
          "index" =&gt;  "party_close_data",
      ));
  
      $this-&gt;addExportType('*/*/exportCsv', Mage::helper('party')-&gt;__('CSV'));
      $this-&gt;addExportType('*/*/exportExcel', Mage::helper('party')-&gt;__('Excel'));
  
      return parent::_prepareColumns();
  }
  
  public function getRowUrl($row) {
      return $this-&gt;getUrl("*/*/edit", array("id" =&gt; $row-&gt;getId()));
  }
  </code></pre>
  
  <p>}</p>