We are developing a C# application for a web-service client. This will run on Windows XP PC\'s.
One of the fields returned by the web service is a DateTime field. Th
DateTime
objects have the Kind
of Unspecified
by default, which for the purposes of ToLocalTime
is assumed to be UTC
.
To get the local time of an Unspecified
DateTime
object, you therefore just need to do this:
convertedDate.ToLocalTime();
The step of changing the Kind
of the DateTime
from Unspecified
to UTC
is unnecessary. Unspecified
is assumed to be UTC
for the purposes of ToLocalTime
: http://msdn.microsoft.com/en-us/library/system.datetime.tolocaltime.aspx