title: How i do filter date range filter in database MVC 5
body: <p><a href="https://i.stack.imgur.com/rh692.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>this is my current code this is my current code i want add filter date range filter in database MVC 5 by referring to the picture, I have done the data show from the database. and find some column
  this is my current code this is my current code i want add filter date range filter in database MVC 5 by referring to the picture, I have done the data show from the database. and find some column
  this is my current code this is my current code i want add filter date range filter in database MVC 5 by referring to the picture, I have done the data show from the database. and find some column</p>
  <p>controller code  :</p>
  <pre><code>public ActionResult Tables()
          {
              try
              {
                  //Creating instance of DatabaseContext class  
                  using (boraEntities entities = new boraEntities())
                  {
                      var draw = Request.Form.GetValues(&quot;draw&quot;).FirstOrDefault();
                      var start = Request.Form.GetValues(&quot;start&quot;).FirstOrDefault();
                      var length = Request.Form.GetValues(&quot;length&quot;).FirstOrDefault();
                      var sortColumn = Request.Form.GetValues(&quot;columns[&quot; + Request.Form.GetValues(&quot;order[0][column]&quot;).FirstOrDefault() + &quot;][name]&quot;).FirstOrDefault();
                      var sortColumnDir = Request.Form.GetValues(&quot;order[0][dir]&quot;).FirstOrDefault();
                      var searchValue = Request.Form.GetValues(&quot;search[value]&quot;).FirstOrDefault();
                      //Paging Size (10,20,50,100)    
                      int pageSize = length != null ? Convert.ToInt32(length) : 0;
                      int skip = start != null ? Convert.ToInt32(start) : 0;
                      int recordsTotal = 0;
                      // Getting all Customer data
                      var customerData = (from tempcustomer in entities.Request_5000
                                          select tempcustomer);
                      var username = Session[&quot;userName&quot;];
                      var role = Session[&quot;role&quot;].ToString().Trim();
                      if (role == &quot;user&quot;)
                      {
                          customerData = customerData.Where(m =&gt; (m.user_login == username));
                      }
                      //Sorting    
                      if (!(string.IsNullOrEmpty(sortColumn) &amp;&amp; string.IsNullOrEmpty(sortColumnDir)))
                      {
                          customerData = customerData.OrderBy(sortColumn + &quot; &quot; + sortColumnDir);
                      }
                      //Search    
                      if (!string.IsNullOrEmpty(searchValue))
                      {
                          customerData = customerData.Where(m =&gt; (m.citizenic_request == searchValue) || (m.strrequest_byuser == searchValue) || (m.api_request == searchValue));
                      }
  
                      //total number of rows count     
                      recordsTotal = customerData.Count();
                      //Paging     
                      var data = customerData.Skip(skip).Take(pageSize).ToList();
                      return Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data });
                  }
              }
              catch (Exception)
              {
                  throw;
              }
  
          }
  </code></pre>
  <p>view code:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot; /&gt;
      &lt;title&gt;NT Bora&lt;/title&gt;
      ...
  
      &lt;script&gt;
          $(document).ready(function () {
              function getDateString(date) {
                  var pattern = /Date\(([^)]+)\)/;
                  var results = pattern.exec(date);
                  var dt = new Date(parseFloat(results[1]));
                  return (dt.getMonth() + 1) + &quot;/&quot; + dt.getDate() + &quot;/&quot; + dt.getFullYear();
              }
              $(&quot;#demoGrid&quot;).DataTable({
                  &quot;processing&quot;: true, // for show progress bar
                  &quot;serverSide&quot;: true, // for process server side
                  &quot;filter&quot;: true, // this is for disable filter (search box)
                  &quot;orderMulti&quot;: false, // for disable multiple column at once
                  &quot;pageLength&quot;: 5,
                  &quot;field&quot;: 'date',
  
                  &quot;ajax&quot;: {
                      &quot;url&quot;: &quot;/Tables/Tables&quot;,
                      &quot;type&quot;: &quot;POST&quot;,
                      &quot;datatype&quot;: &quot;json&quot;
                  },
  
                  &quot;columnDefs&quot;:
                      [{
                          &quot;targets&quot;: [0],
                          &quot;visible&quot;: false,
                          &quot;searchable&quot;: false
                      },
                      {
                          &quot;targets&quot;: [5],
                          &quot;searchable&quot;: false,
                          &quot;orderable&quot;: false
                      },
                      ],
  
                  &quot;columns&quot;: [
                      { &quot;data&quot;: &quot;id&quot;, &quot;name&quot;: &quot;id&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;citizenic_request&quot;, &quot;name&quot;: &quot;citizenic_request&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;user_login&quot;, &quot;name&quot;: &quot;user_login&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;system_name&quot;, &quot;name&quot;: &quot;system_name&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;strrequest_byuser&quot;, &quot;name&quot;: &quot;strrequest_byuser&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;api_request&quot;, &quot;name&quot;: &quot;strrequest_byuser&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;message&quot;, &quot;name&quot;: &quot;message&quot;, &quot;autoWidth&quot;: true },
                      { &quot;data&quot;: &quot;createdAt&quot;, &quot;name&quot;: &quot;createdAt&quot;, &quot;render&quot;: function (data) { return getDateString(data); } },
                  ]
  
              }).columnFilter({
                  &quot;aoColumns&quot;: [
                      { &quot;type&quot;: &quot;number-range&quot; },
                      { &quot;type&quot;: &quot;text&quot; },
                      { &quot;type&quot;: &quot;select&quot; },
                      { &quot;type&quot;: &quot;date-range&quot; }
                  ]
              });
          });
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;br /&gt;
          &lt;div style=&quot;width:90%; margin:0 auto;&quot;&gt;
             
              &lt;table id=&quot;demoGrid&quot; class=&quot;table table-striped table-bordered dt-responsive nowrap&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot;&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;id&lt;/th&gt;
                          &lt;th&gt;Citizenic Request&lt;/th&gt;
                          &lt;th&gt;Usre&lt;/th&gt;
                          &lt;th&gt;System Name&lt;/th&gt;
                          &lt;th&gt;Strrequest By User&lt;/th&gt;
                          &lt;th&gt;API Name&lt;/th&gt;
                          &lt;th&gt;Message&lt;/th&gt;
                          &lt;th&gt;Date&lt;/th&gt;
                          @*&lt;th&gt;Edit&lt;/th&gt;
                      &lt;th&gt;Delete&lt;/th&gt;*@
                      &lt;/tr&gt;
                  &lt;/thead&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>