Its one of thse things that should be easy.
However if you get your DateTime from a database it will be anonymous, i.e. it will not have its kind set.
So, do this:
DateTime ConvertFromLocalToUTC(DateTime localTime)
{
DateTime anon = new DateTime(localTime.Ticks, DateTimeKind.Local);
DateTime dtUTC = anon.ToUniversalTime();
return dtUTC;
}
Oh, and, in other news, happy Imbolc!
Thursday, 4 February 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment