Or is this even possible?
As a side question and the reason for this question coming into existence for me is to understand what happens to the DateTime object when user changes Windows culture settings at runtime?
Or is this even possible?
As a side question and the reason for this question coming into existence for me is to understand what happens to the DateTime object when user changes Windows culture settings at runtime?
What happens to the DateTime object when user changes Windows culture settings at runtime?
Nothing. Any existing values of DateTime
are unchanged.
the DateTime object is always assumed to be local time?
No. A DateTime
value can be either a "local" value, a "UTC" value, or a value of "unspecified" kind.
I just dont understand why date.ToLocalTime().ToLocalTime() changes the value only once?
Methods on DateTime
that convert between the two check what kind of DateTime
value the current value represents. If the current value is already of the kind being requested, the method just returns the current value.
So once you've called ToLocalTime()
, you now have a "local" kind of DateTime
, and if you call ToLocalTime()
again you're just going to get that same value back.
Value of DateTime field never changed when user changes windows culture setting at runtime.
No, we cannot assume DateTime value as a local time.