Calculate how many days (hours, seconds...) between 2 DateTime values
2011-04-08
How to Calculate how many days (hours, seconds...) between 2 DateTime values?
Here we have example code:
We have 2 DateTimes: StartTime, EndTime
int idays = EndTime.Subtract(StartTime).Days;
int iHours = EndTime.Subtract(StartTime).Hours;
int iMinutesdays = EndTime.Subtract(StartTime).Minutes;
int iSeconds = EndTime.Subtract(StartTime).Seconds;