DateTime Unspecified Kind

No, Unspecified and UTC are very different - the page you're quoting from is from ToLocalTime. The point is that if you call ToLocalTime using an "unspecified" DateTime, then the value will be treated as if it were in UTC.

Likewise if you call ToUniversalTime using an "unspecified" DateTime, then the value will be treated as if it were in the system local time zone.

Frankly this sort of thing is why I dislike DateTime rather a lot. If I were you, I'd use Noda Time instead, which separates the concepts out into different types entirely, removing a lot of the confusion. (There are more types to know about, but each one represents a single concept.) I'm clearly biased though...


The DateTimeKind.Unspecified is useful in cases where you don't want the time to be converted to another local time.

Take for example a server application which displays the current time for the server in a client application. If you do not specify DateTimeKind.Unspecified on the server and the current time is retrieved through a WCF call, then when .ToString is called in the client application, it will automatically be converted to the local time zone if they are different.

Tags:

C#

Datetime