Difference(StartDate: DateTime; EndDate: DateTime): TimeSpan;
StartDate - start date.
EndDate - end date.
The Difference method calculates difference between two dates: the start date specified in the StartDate parameter and the end date specified in the EndDate parameter.
Sub Main;
Var
d, d1: DateTime;
t: TimeSpan;
Begin
d := DateTime.Parse("01.01.2002 14:20:15");
d1 := DateTime.Parse("01.01.2003 15:25:20");
t := DateTime.Difference(d, d1);
End Sub Main;
After executing the example the "t" variable will contain the difference between the specified dates, that is, 365 days, 1 hour 5 minutes and 5 seconds.
See also: