i have 2 datetime
values:
date1 <- {15-07-13 20:45:10} kind = unspecified
date2 <- {15-07-13 20:45:10} kind = utc
when comparing these 2 dates, 2 dates equal.
if (datetime.compare(date1, date2)!=0) ...
can can explain why?
a little bit more strange me: when converting date1 (which unspecified kind) utc, see date different:
date1.touniversaltime() --> {15-07-13 18:45:10} kind = utc
does can explain me why?
yup. it's because datetime
fundamentally broken type, imo. kind
isn't used in comparisons. doing quite possibly have broken old code, , it's not want. added on .net 1.1, , not in great way - wasn't integrated in every way might have expected, you've seen comparisons.
as example, kind
of local
(which meant system local time zone) it's ignored arithmetic, means call of addhours(1)
adds local time, rather representing elapsed time (which end being same local time or 2 hours later in local time, around dst transitions).
my advice avoid comparing datetime
values of different kinds in first place. it's never want do.
(of course i'd recommend using noda time, that's different matter.)
Comments
Post a Comment