title: yII2:Date filter how to in Gridview
body: <p>Well I can filter on any fields including the column from related fields, but I wonder how I can filter on date fields.</p>
  
  <p>One solution I came across is date-picker for filter, I have not tested this, but my requirement is little different.</p>
  
  <p>for example I have duplicated the <code>datetime</code> column in gridview and formatted it like</p>
  
  <pre><code>[
      'attribute'=&gt;'discharge_date',
      'format'=&gt;['DateTime','php:M']
  ],
  </code></pre>
  
  <p>So that the column will show only months.The column is showing the months correctly. </p>
  
  <p>Now I want to filter by month on this column.
  Any suggestion will be greatly appreciated.
  Thanks.</p>
  
  <p>I did try like this</p>
  
  <pre><code>[
       'attribute'=&gt;'discharge_date',
       'value'=&gt;'discharge_date',
       'filter' =&gt; ['2015-01'=&gt;'Jan','2015-02'=&gt;'Feb','2015-03'=&gt;'Mar'],
       'format'=&gt;['DateTime','php:M']
  
    ],
  </code></pre>
  
  <p>This works fine, but here the year is being hard-coded, which I don't want.
  I know this is not the proper way.
  Thanks</p>