On 11 Oct 2013, at 4:05am, tpalumbo <[email protected]> wrote:

> Have a strange issue.  Creating a Windows Phone 8 app, (c#, xaml), using
> SQLite.  I have a simple table that has 3 fields defined in database as
> follows
> RecordID (int)
> Name (nvarchar)
> RecordDate (DateTime)
> 
> In the in the app the model is defined the same.
> The table does have 5 records in it and all 3 fields of each record does
> have data in it.  I looked.
> Strange thing is that when I run a query on it to populate a listbox, the
> listbox does fill with all records but the RecordDate column displays
> 1/1/0001 for all 5 records.  What am I doing wrong?

There is no DateTime format in SQLite.  (There's no 'nvarchar' format either.)  
Those dates are probably not being stored correctly because you are assuming 
some conversion is taking place and it isn't.

Dates are usually stored as strings (if you mostly want printing) or epoch 
numbers or Julian date numbers (if you mostly want maths).  Define your field 
as TEXT, INTEGER or REAL appropriately, and do whatever conversion is needed to 
get the right values into the database.

You may find this page useful:

<http://www.sqlite.org/lang_datefunc.html>

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to