title: LINQ to Entities does not recognize the method 'System.DateTime ParseExact(System.String, System.String, System.IFormatProvider)' method error in MVC5
body: <p>Hi i  have one view called <strong>DailyVisitReport</strong>. In that view i have two field called <strong>FromDate</strong> and <strong>toDate</strong>. if i select the FromDate and ToDate depends upon the date it shows the table with data in the same view (like partial view).</p>
  
  <p>Now FromDate and ToDate date Format in jquery is "dd-M-y"(01-Mar-16)</p>
  
  <p>In Db also i changed the Date format to (01-Mar-16 STRING).</p>
  
  <p><strong>My Model(VisitorsViewModel)</strong></p>
  
  <pre><code>public DateTime FromDate { get; set; }
  public DateTime ToDate { get; set; }
  public ICollection&lt;View_VisitorsForm&gt; Visits { get; set; }
  </code></pre>
  
  <p><strong>My Controller Code</strong></p>
  
  <pre><code>public ActionResult GetDatesfromFromDateToDate(string fromDate, string toDate)
  {
      CultureInfo provider = CultureInfo.InvariantCulture; 
      var fromdt = Convert.ToDateTime(fromDate);
      var  todt = Convert.ToDateTime(toDate);
      List&lt;View_VisitorsForm&gt; VisitCount = (from v in db.View_VisitorsForm where DateTime.ParseExact(v.VisitingDate,"dd-M-y", provider) &gt;= fromdt &amp;&amp; DateTime.ParseExact(v.VisitingDate,"dd-M-y",provider) &lt;= todt select v).ToList();
      VisitorsViewModel visitotsVM = new VisitorsViewModel();
      visitotsVM.Visits = VisitCount;
      return PartialView("_Visitors", visitotsVM);
  }
  </code></pre>
  
  <p>Now I select the <code>FromDate</code> and <code>ToDate</code> it show the error which is mention below</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.DateTime ParseExact(System.String, System.String, System.IFormatProvider)'
    method</p>
  </blockquote>
  
  <p>I cant able to convert that <code>v.VisitingDate</code> to <code>DateFormat</code> from string format .</p>
  
  <p>I tried <code>Convert.ToDateTime</code> and <code>Convert.ToParse</code> all things. still I'm getting error. please any one understand my issue and help me to resolve this issue.</p>