Calculating a Time for a TimeZone

Oh things are easy when you know how. I've been trying to do this for ages and then I got asked by Saad to help. Start by performing

IEnumerable<TimeZoneInfo> tzis = TimeZoneInfo.GetSystemInfos();

Then have a look to find the correct ID from the 87 items e.g. "Eastern Standard Time";

DateTime usTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,
TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));

Thanks Saad.

Add comment

  Country flag


  • Comment
  • Preview
Loading