How do I get the time difference between two DateTime objects using C#?

前端 未结 9 2180
臣服心动
臣服心动 2020-11-27 11:38

How do I get the time difference between two DateTime objects using C#?

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 12:01

    IF they are both UTC date-time values you can do TimeSpan diff = dateTime1 - dateTime2;

    Otherwise your chance of getting the correct answer in every single possible case is zero.

提交回复
热议问题