Check difference in seconds between two times

前端 未结 4 2018
挽巷
挽巷 2020-12-07 19:36

Hi all I am currently working on a project where when a certain event happens details about the event including the time that the event occurred is added into a list array.

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 20:03

    I use this to avoid negative interval.

    var seconds = (date1< date2)? (date2- date1).TotalSeconds: (date1 - date2).TotalSeconds;
    

提交回复
热议问题