Re: [sqlite] String not valid DateTime

2012-12-10 Thread Tim Streater
On 10 Dec 2012 at 14:05, William Drago  wrote:

> I am using SQLite with C# and am having trouble with SQLite
> DATETIME types. The following error occurs when trying to
> read rows from a table that contains dates (e.g. "12/09/2012
> 22:51:24"). (I am using a SQLiteDataReader to put query
> results into a C# DataTable.)
>
> "String was not recognized as a valid DateTime."
>
> Apparently SQLite stores dates as strings while C# is
> expecting an object of some sort. Any thoughts or solutions?
> As a work-around I changed all my DATETIME types to VARCHARs.

Suggest the OP reads this also:

http://sqlite.org/datatype3.html

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


Re: [sqlite] String not valid DateTime

2012-12-10 Thread Clemens Ladisch
William Drago wrote:
> I am using SQLite with C# and am having trouble with SQLite DATETIME
> types.

In SQLite, the DATETIME type is interpreted in the same way as the
FLUFFY_BUNNIES type, i.e., it is not recognized at all.  Due to
SQLite's dynamic typing, values in that column have the same type that
they were inserted as: .

> The following error occurs when trying to read rows from a table that
> contains dates (e.g. "12/09/2012 22:51:24").

Is that ninth December or twelfth September?

Date/times are can be stored as number or strings; strings should have
the format '-mm-dd hh:mm:ss':



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


Re: [sqlite] String not valid DateTime

2012-12-10 Thread Igor Tandetnik
William Drago  wrote:
> I am using SQLite with C# and am having trouble with SQLite
> DATETIME types. The following error occurs when trying to
> read rows from a table that contains dates (e.g. "12/09/2012
> 22:51:24"). (I am using a SQLiteDataReader to put query
> results into a C# DataTable.)

Change your date format to '2012-12-09 22:51:24'. For more details, see

http://sqlite.org/lang_datefunc.html

"Time Strings" section.
-- 
Igor Tandetnik

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