uses
dateutils;
// 两个时间之间的年数
Function YearsBetween(const ANow, AThen: TDateTime): Integer;
// 两个时间之间的月数
Function MonthsBetween(const ANow, AThen: TDateTime): Integer;
// 两个时间之间的星期数
Function WeeksBetween(const ANow, AThen: TDateTime): Integer;
// 两个时间之间的天数
Function DaysBetween(const ANow, AThen: TDateTime): Integer;
// 两个时间之间的小时数
Function HoursBetween(const ANow, AThen: TDateTime): Int64;
// 两个时间之间的分钟数
Function MinutesBetween(const ANow, AThen: TDateTime): Int64;
// 两个时间之间的秒数
Function SecondsBetween(const ANow, AThen: TDateTime): Int64;
// 两个时间之间的毫秒数
Function MilliSecondsBetween(const ANow, AThen: TDateTime): Int64;
// // 两个时间之间的年、月、日数
Procedure PeriodBetween(const ANow, AThen: TDateTime; Out Years, months, days : Word);