delphi 计算l两个日期的时间间隔月数,月数差
此种方法计算月份差不准,比如2017-2-1 到 2016-10-2 ,还是用StrToInt() 转化月为整形后再相减计算
use DateUtils;
Edit1.Text:=intToStr(MonthsBetween(StrToDateTime('2012-10-2'),StrToDateTime('2012-5-1')));
Edit1.Text:=intToStr(MonthsBetween(DateTimePicker2.Date,DateTimePicker1.Date));