本文整理自网络,侵删。
此种方法计算月份差不准,比如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));
相关阅读 >>
Delphi中使用xmlhttp / xmlhttprequest 避免缓存
更多相关阅读请进入《Delphi》频道 >>