1

I'm trying to convert a UTC to a CST by using the 'ConvertTimeFromUtc' method. However, the result is off by 1 hour compared to what I got when I try to convert it manually online.

StatusDatetime is 2017-06-05 21:14:39.6216795  
TimeZoneInfo.ConvertTimeFromUtc(StatusDatetime.Value, 
TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")).ToString("hh:mm 
tt")
Tuan Le
  • 37
  • 5

1 Answers1

0

Try using Central Daylight Time instead of Central Standard Time, as we are in daylight savings time.

Berkley Lamb
  • 283
  • 2
  • 12
  • Thanks but I'm getting the error below when I try what you suggested : The time zone ID 'Central Daylight Time' was not found on the local computer. – Tuan Le Jun 05 '17 at 14:29
  • Ah, that is because i was wrong, check out the following https://stackoverflow.com/questions/2961848/how-to-use-timezoneinfo-to-get-local-time-during-daylight-savings-time its in c#, but i don't see it being much different via java – Berkley Lamb Jun 05 '17 at 16:51