Olexandr Kravets wrote:
>  
> Some columns in
> database are used to store date and time in UTC and some in local.
> 

You are storing both date/time values in both local time and UTC time in the
same database?  This is problematic, see below.

> 
> 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.
> 

By default, the DateTimeKind value used is Unspecified.  When storing
date/times
from multiple time zones (i.e. including UTC and local time), it is highly
recommended that all DateTime values should be stored as UTC and then the
DateTimeKind.Utc value should be used when opening the database connection.

> 
> Is it possible to find some information, why date/time
> format was changed?
> 

Prior to the changes that added DateTimeKind, there was no reliable way to
get
consistently correct DateTime values out of a column, even if the values
were
correctly stored using UTC.

This is partially due to the fact that the .NET Framework itself does not
attempt
to automatically convert or recognize DateTime values to any particular time
zone
when using the DateTime.Parse or DateTime.TryParse methods, including local
time.
Also, it will not, by itself, recognize a trailing "Z" to indicate UTC time
in
these situations.  Instead, the DateTimeKind value must be used with the
SpecifyKind
method to construct a DateTime value with the appropriate time zone, which
can
only be UTC or local time.

Therefore, if the application requires date/time values from multiple time
zones,
the only reasonable choice is storing everything in UTC time, using
DateTimeKind.Utc
for the database connection, and converting to local time for the user
interface.

--
Joe Mistachkin

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to