I have a big problem with datetime fields.
If I write an entity to database having a datetime property set to DateTime.UtcNow the correct utc time will be in the database.
But when I select this field from db using linq to entities I get a date that has already been converted back to local time.
I need to get a utc datetime back from the db provider.
In the connectionstring no DateTimeFormat is set, so iso8601 is used.
What's the problem?
Best regards,
cew3
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a big problem with datetime fields.
If I write an entity to database having a datetime property set to DateTime.UtcNow the correct utc time will be in the database.
But when I select this field from db using linq to entities I get a date that has already been converted back to local time.
I need to get a utc datetime back from the db provider.
In the connectionstring no DateTimeFormat is set, so iso8601 is used.
What's the problem?
Best regards,
cew3
There is a relatively new parameter DateTimeKind in the connection string that has to be set to "UTC"
Many thanks to Joe Mistachkin from the sqlite-user mailing list
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users