SQLite and DateTime Columns

Just a heads up, if you’re storing dates into a SQLite database using C# make sure your DateTime has the correct DateTime.Kind set otherwise it will default to GMT. Either use DateTime.UtcNow or set the kind after the fact by calling DateTime.SpecifyKind like so:

var someDate = DateTime.Parse('01/13/1981 12:30:00');
var utc = DateTime.SpecifyKind(someDate , DateTimeKind.Utc); // now we are UTC

Leave a Reply

Your email address will not be published. Required fields are marked *