title: Truncate date while filtering date within dategridview
body: <p>I am trying to filter <code>DataGridView</code> bounded from <code>DataTable</code> source<code>by using</code>DateTimePicker` </p>
  
  <p>my problem is that column <code>DATETIME</code> has date and time and I just want to use only date without time example </p>
  
  <pre><code>select cast(DATETIME as DATE) from table_name
  </code></pre>
  
  <p>I tried below but I get error message says </p>
  
  <blockquote>
    <p>the expression contains undefined function call cast()</p>
  </blockquote>
  
  <p>so How i can truncate the date ?</p>
  
  <pre><code>(MyDataGridView.DataSource as DataTable).DefaultView.RowFilter = string.Format("cast(DATETIME as DATE)= '{0}'", DpickerEntryDate.Value.ToShortDateString());
  </code></pre>
  
  <p>all event code </p>
  
  <pre><code>        if (DpickerEntryDate.Value.Date &lt;= DateTime.Today.Date)
          {
              (MyDataGridView.DataSource as DataTable).DefaultView.RowFilter = string.Format("cast(DATETIME as DATE) = '{0}'", DpickerEntryDate.Value.ToShortDateString());
          }
          else if (DpickerEntryDate.Value.Date &gt; DateTime.Today.Date)
          {
              MessageBox.Show("Can not use future date", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
          }
          else
          {
              //do something
          }
  </code></pre>
  
  <p>Thanks</p>