System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 29d980c3d0854a5c5d4d66d4d0575908d00e5131
Title: Reader.GetDateTime converts Datetime to localtime
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Data_Reader Resolution: Works_As_Designed
Last Modified: 2013-10-15 06:29:02
Version Found In: 1.0.88
User Comments:
anonymous added on 2013-10-14 11:53:43:
I have an application that stores the datetime column always in UTC. I convert it to local datetime when needed in the UI (the likes of the export functionality needs raw data - same as in the db, UTC datetime). All spot on with the version 1.0.74 I was using before.

Since I upgraded to 1.0.85 (tested it in 1.0.88 too, same result), I realized that the reader.GetDateTime method automatically converts the datetime column to the (the machine's) local time.

It's not the behaviour I expected and a change from the previous versions, would it be possible that the reader.GetDateTime returns the datetime in the timezone that is stored in the db?

anonymous added on 2013-10-14 13:58:59:
Checking the source I just figured out that we need to specify the DateTimeKind to Utc in the connectionstring. Not sure why it's not Utc by default anyway...