Hello all,
Currently, I am using version 1.0.66 SQLite.NET and all datetime columns by default have following format: 2012-11-05 16:05:10.3702633 Some columns in database are used to store date and time in UTC and some in local. Therefore, there is no way to see if column saved UTC time or local. Currently, following test case pass: DateTime CheckedAt = new DateTime(2000, 1, 1, 3, 44, 55).ToUniversalTime(); // Save to database // 2000-01-01 08:44:55 // Retrieve from db {1/1/2000 8:44:55 AM} basically like line below DateTime DateTimeFromDB = new DateTime(2000, 1, 1, 8, 44, 55, DateTimeKind.Unspecified); Assert.AreEqual(CheckedAt.ToString(), DateTimeFromDB.ToString(), "Retrieved date and time does not match to stored."); After I tried to run the same test with 1.0.82 and in database I’ve got different result … It failed. DateTime CheckedAt = new DateTime(2000, 1, 1, 3, 44, 55).ToUniversalTime(); // Save to database // 2000-01-01 08:44:55Z // Retrieve from db {1/1/2000 3:44:55 AM} basically like line below DateTime DateTimeFromDB = new DateTime(2000, 1, 1, 3, 44, 55, DateTimeKind.Unspecified); Assert.AreEqual(CheckedAt.ToString(), DateTimeFromDB.ToString(), "Retrieved date and time does not match to stored."); Looks like, SQLite 1.0.82 returns date and time as local time by default. Also time stored in DB with Z at the end. Of course, I found that I could specify in connection string DateTimeKind = DateTimeKind.Utc. After that test is passed. I came to following conclusion. If I migrate to 1.0.82, then I definitely need to specify DateTimeKind and make it equal to Utc. After that I will have no issues with time, which I stored and used as UTC before. Local time will be returned to me as UTC, but because I don’t make any conversion with it, I will see it on UI as is, which will be matching to current behavior. Am I correct? Is it possible to find some information, why date/time format was changed? Thank you, Olexandr _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users