Re: [sqlite] SQLite DateTime issue

2013-10-11 Thread Simon Slavin

On 11 Oct 2013, at 4:05am, tpalumbo  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:



Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite DateTime issue

2013-10-11 Thread tpalumbo
Hi All,

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?



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/SQLite-DateTime-issue-tp71650.html
Sent from the SQLite mailing list archive at Nabble.com.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users