Subtraction of one time from another will give
System.TimeSpan
, but don't use a function, use "-" operator, which is most readable, leaves no questions:
System.DateTime t1 =
System.DateTime t2 =
System.TimeSpan period = t2 - t1;
int wholeDays = period.Days;
float days = period.TotalDays;
int wholeHours = period.Hours;
float hours = period.TotalHours;
int wholeMilliseconds = period.Milliseconds;
float milliseconds = period.TotalMilliseconds;
See
http://msdn.microsoft.com/en-us/library/system.timespan.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[
^].
—SA