Days, hours, minutes, seconds between two dates

后端 未结 9 1055
挽巷
挽巷 2020-12-01 07:29

I have two dates, one less than the other. I want to create a string such as this one

\"0 days, 0 hours, 23 minutes, 18 seconds\"

representing the differenc

9条回答
  •  抹茶落季
    2020-12-01 07:43

    TimeSpan diffTime = dateTimeNew -PreviousDate;
    int days=diffTime.Days;
    int hours=diffTime.Hours;
    int minutes=diffTime.Minutes;
    int seconds=diffTime.Seconds;
    

提交回复
热议问题