Grzegorz Zielinski - 160 - Dec 31, 2013


Searching by date in OrmLite and SQLite provider don’t work.

Here is sample code snippet:

 public class TestDto
   public DateTime Date { get; set; }

var d = DateTime.Now;
Db.Insert<TestDto>(new TestDto() { Date = d });
var records = Db.SelectFmt<TestDto>(“Date == {0}”, d);

After this records.Count is 0;

The problem is caused by the date formating. OrmLite date format is: “yyyy-MM-ddTHH:mm:ssZ” but SQLite does not recognize format with “T” letter. Valid SQLite format for select is without “T” for example: “yyyy-MM-dd HH:mm:ss”.