Creating a DateTime in a specific Time Zone in c#

后端 未结 7 1637
自闭症患者
自闭症患者 2020-11-22 10:24

I\'m trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected.

In the test I n

7条回答
  •  死守一世寂寞
    2020-11-22 10:56

    Using TimeZones class makes it easy to create timezone specific date.

    TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById(TimeZones.Paris.Id));
    

提交回复
热议问题