title: DataTable filter expression with DateTime and less-or-equal operator problem
body: <p>I have the following code:</p>
  
  <pre>
  <code>
              DataTable t = new DataTable();
              t.Locale = CultureInfo.InvariantCulture;
              t.Columns.Add("Date", typeof(DateTime));
  
              DateTime today = DateTime.Now;
              DateTime yesterday = today.AddDays(-1);
              DateTime tomorow = today.AddDays(1);
  
              t.Rows.Add(yesterday);
              t.Rows.Add(today);
              t.Rows.Add(tomorow);
  
              string filter = string.Format(CultureInfo.InvariantCulture,
                  "Date >= #{0}# AND Date &lt;= #{1}#", yesterday, tomorow);
  
              t.DefaultView.RowFilter = filter;
  
              foreach (DataRowView v in t.DefaultView)
                  Console.WriteLine(v["date"]);
  </code>
  </pre>
  
  <p>I'm expecting that the filtered <code>t.DefaultView</code> now contains all three "days". But for some reason the last date from the range isn't included. It seems <code>&lt;=</code> operator for <code>DateTime</code> type works like a <code>&lt;</code>.</p>
  
  <p>Where is the problem? Is that a bug? Any suggestions how to overcome that?</p>
  
  <p><strong>Update.</strong>
  Got some responses about <code>DateTime</code> type and comparison operators. Thanks.
  But now I want to direct attention to <a href="http://msdn.microsoft.com/en-us/library/69c06922%28VS.71%29.aspx" rel="nofollow noreferrer">filter expression</a>.
  Ok, say I have the folloving loop:</p>
  
  <pre>
  <code>
  foreach (DataRow r in t.Rows)
  {
    DateTime date = (DateTime)r["Date"];
    if (yesterday &lt;= date && date &lt;= tomorow)
        Console.WriteLine(date);
  }
  </code>
  </pre>
  
  <p>This loop should show the same result like</p>
  
  <pre>
  <code>
  foreach (DataRowView v in t.DefaultView)
    Console.WriteLine(v["date"]);
  </code>
  </pre>
  
  <p>from the previous example, yes? No! Here <code>&lt;=</code> works as I'm expecting and the result is all three days. Why?</p>
  
  <p><strong>Update #2: solution.</strong>
  As Joe has noted - the problem is about fractions of a second.
  If I format upper and lower bounds with Round-trip date/time pattern (to preserve fractions of a second) - everything works just fine:</p>
  
  <pre>
  <code>
  
  string filter = string.Format(CultureInfo.InvariantCulture,
                  "Date >= '{0}' AND Date &lt;= '{1}'",
                  yesterday.ToString("o", CultureInfo.InvariantCulture),
                  tomorow.ToString("o", CultureInfo.InvariantCulture));
  </code>
  </pre>