C# Datetimes: Conversion for different time zones

前端 未结 6 773
[愿得一人]
[愿得一人] 2020-12-01 19:06

I have a bunch of date times that I keep track of for my app. They are all in UTC time. For part of my app I want to send an email with one of these times, but edited to be

6条回答
  •  Happy的楠姐
    2020-12-01 19:47

    This should do the trick

    DateTime localTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.Local);
    

提交回复
热议问题