Sqlite-net datetime retrieval

.net, datetime, sqlite, sqlite-net

Solution

There is a StoreDateTimeAsTicks property on the SQLiteConnection object that you should use. Set it to 'false'. Worked for me.

Problem

Hi I have a problem with retrieving datetime from SQLite database using sqlite-net library. Db column is of type DATE, example date in one of records is: 2013-08-02 I have a model: ``` internal class FCost { [PrimaryKey, AutoIncrement] public int Id { get; set; } ... public DateTime AccountingDate { get; set; } ... } ``` I execute this line of code: ``` var result = dc.Table<FCost>().ToArray(); ``` Every field except AccountingDate is filled correctly, all DateTime fields are filled with value: {1/1/0001 12:00:00 AM} (visual studio debbuger view). Why is date not parsed correctly? I tried switching Db column type to DATETIME and TEXT but got same results. EDIT. Object dc used above is of type SQLiteConnection from sqlite-net library.

Original source