I have the following ASP.Net MVC Controller method:
public ActionResult DoSomething(DateTime utcDate)
{
var localTime = utcDate.ToLocalTime();
}
as described by MSDN, you need the Kind property of your Date to be UTC, for the ToLocalTime() to work (and convert the date to local time. http://msdn.microsoft.com/en-us/library/system.datetime.tolocaltime.aspx
Try this:
utcDate = DateTime.SpecifyKind(utcDate, DateTimeKind.Utc);
var localTime = utcDate.ToLocalTime();