oysteinkrog / SQLite.Net-PCL

Simple, powerful, cross-platform SQLite client and ORM - Updated version with PCL support
MIT License
353 stars 162 forks source link

date() function not working? #385

Open BloodyRain2k opened 4 years ago

BloodyRain2k commented 4 years ago

I've just spent a few days trying to filter my Android Sqlite db for entries made on a certain day and NOTHING worked.

I tried feeding it iso dates (yyyy-mm-dd hh:mm:ss) as string, blank (threw errors obviously), with the "date()" function and returned anything usable.

So after a while I started concentrating on the date function itself and found out that, for me at least, it doesn't work at all.

date('now') returns 0001-01-01 00:00:00 and so does everything else I fed it, even ticks as strings and numbers. I have not managed to make this function return ANYTHING other than the 1st Jan of the year 1....

Could someone please look into this and check if I just used it wrong for some reason, even though I went through dozen Sqlite docs, or if it's really broken.

With the setting "storeDateTimeAsTicks" being true by default, it's be neccessary that this function works.

The only way I got my personal case working was by turning it off which finally allowed me to successfully use 'select' with 'between' which was impossible before.