title: Linq-To-Entities and query with dates
body: <p>I am using the <a href="http://arshaw.com/fullcalendar/" rel="nofollow">Fullcalendar</a> jquery plugin to show events on a calendar view in my MVC 4 application.</p>
  
  <p>I have configured the plugin which is correctly calling my controller action passing in two double parameters who represents the start date and the end date showed on the current view in unix timestamp formats.</p>
  
  <p>Here you can see my controller action method</p>
  
  <pre><code>[HttpPost]
  public ActionResult GetEvents( double start, double end ) {
      DateTime dtStart = DateTimeUtils.UnixTimeStampToDateTime( start );
      DateTime dtEnd = DateTimeUtils.UnixTimeStampToDateTime( end );
  
      IPolicyRepository _pRepo = _uow.PolicyRepository;
      IEnumerable&lt;Policy&gt; model = 
      _pRepo.Find( p =&gt; p.EndDate &gt;= dtStart.Date &amp;&amp; p.EndDate &lt; dtEnd.Date );
  
      ...
  }
  </code></pre>
  
  <p>The method <code>DateTimeUtils.UnixTimeStampToDateTime(double)</code> converts a unix timestamp in a datetime object in the following way</p>
  
  <pre><code>public static DateTime UnixTimeStampToDateTime( double unixTimeStamp ) {
      // Unix timestamp is seconds past epoch
      DateTime dtDateTime = new DateTime( 1970, 1, 1, 0, 0, 0, 0 );
      dtDateTime = dtDateTime.AddSeconds( unixTimeStamp ).ToLocalTime();
      return dtDateTime;
  }
  </code></pre>
  
  <p>However the <code>Find</code> method of the repository, which in turn simply pass the lambda to the EF does not return any row even if some rows exists.
  I am suspecting that this problem could be due to differents formats and/or locale I have between the browser and the database server. </p>
  
  <p>How can I solve this problem and create a query which will be aware of locales and specific formats used?</p>
  
  <p><strong>EDIT</strong>: 
  For further informations I am adding the model definition here</p>
  
  <pre><code>public partial class Policy
  {
      public int PolicyID { get; set; }
  
      [...]
  
      [Required]
      [DisplayName( "Begin date" )]
      [DisplayFormat( ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MM-yyyy}" )]
      public DateTime BeginDate { get; set; }
  
      [Required]
      [DisplayName( "Due Date" )]
      [DisplayFormat( ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MM-yyyy}" )]
      public DateTime EndDate { get; set; }
  }
  </code></pre>