eschneider FE wrote: > > So when using System.Data.SQLite and inserting data using a parameter of > datetime, I believe the System.Data.SQLite .net lib is doing a ToString() on > datetime when it should be using a specific date format supported by SQlite. >
The DateTime parsing and formatting performed by System.Data.SQLite are governed by the DateTimeKind and DateTimeFormat properties provided in the connection string. The default values are "DateTimeKind.Unspecified" and "SQLiteDateFormats.ISO8601", respectively. When using the ISO-8601 format, the date/time strings must conform to one of the "well-known" formats supported by System.Data.SQLite, specifically: /// <summary> /// An array of ISO-8601 DateTime formats that we support parsing. /// </summary> private static string[] _datetimeFormats = new string[] { "THHmmssK", "THHmmK", "HH:mm:ss.FFFFFFFK", "HH:mm:ssK", "HH:mmK", "yyyy-MM-dd HH:mm:ss.FFFFFFFK", /* NOTE: UTC default (5). */ "yyyy-MM-dd HH:mm:ssK", "yyyy-MM-dd HH:mmK", "yyyy-MM-ddTHH:mm:ss.FFFFFFFK", "yyyy-MM-ddTHH:mmK", "yyyy-MM-ddTHH:mm:ssK", "yyyyMMddHHmmssK", "yyyyMMddHHmmK", "yyyyMMddTHHmmssFFFFFFFK", "THHmmss", "THHmm", "HH:mm:ss.FFFFFFF", "HH:mm:ss", "HH:mm", "yyyy-MM-dd HH:mm:ss.FFFFFFF", /* NOTE: Non-UTC default (19). */ "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-ddTHH:mm:ss.FFFFFFF", "yyyy-MM-ddTHH:mm", "yyyy-MM-ddTHH:mm:ss", "yyyyMMddHHmmss", "yyyyMMddHHmm", "yyyyMMddTHHmmssFFFFFFF", "yyyy-MM-dd", "yyyyMMdd", "yy-MM-dd" }; The DateTime.ParseExact method is used by System.Data.SQLite; therefore, if the DateTime string does not conform to one of the above formats, an exception will be generated. -- Joe Mistachkin _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users