delphi 如何判断两个时间日期间隔 是否为整月?

2016-07-01~~2016-07-31  整月
2016-08-05~~2016-08-31  非整月
2016-09-12~~2016-09-30  非整月
2016-02-01~~2016-02-26  非整月

就是这个意思,如何搞?

注意要USES   DateUtils单元;

procedure TMDI_1_1_Frm.Button8Click(Sender: TObject);
var S,Date1,Date2:string;
begin
  S:='2016-08-05~~2016-08-31';
  Date1:=Copy(S,1,10);
  Date2:=Copy(S,13,10);
  if (StartOfTheMonth(StrToData(Date1))=StrToData(Date1)) and
     (EndOfTheMonth(StrToDate(Date2))=StrToData(Date1))
    then showMessage('整月!')
    else showMessage('非整月!')
end;
 
或者
 
var
  sdate,date1,date2:string;
begin
  sdate:='2016-02-01~~2016-02-28';
  Date1:=Copy(Sdate,1,10);
  Date2:=Copy(Sdate,13,10);
  if (dayof(strtodate(date1))<>1or  (dayof(incday(strtodate(date2)))<>1)
  then
    showmessage('非整月')
  else
    showmessage('整月');
end;
 
 
 
  
 
  
 
 
 
 
 
  
 
 
原文地址:https://www.cnblogs.com/lantianhf/p/6037376.html