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.
There is a StoreDateTimeAsTicks property on the SQLiteConnection object that you should use. Set it to 'false'. Worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With