我也来一招[][][]
procedure TForm1.Button1Click(Sender: TObject);
begin
; ShowMessage(IntToStr(GetDaysInMonth(now())));
end;
function TForm1.GetDaysInMonth(pToday :TDatetime):integer;
var dTemp1,dTemp2 :TDateTime;
; ; iMonth,iYear,iDay :word;
begin
; dTemp1 :=StrToDateTime(FormatDateTime('yyyy-mm-01 01:01:01',pToday));
; DecodeDate(pToday,iYear,iMonth,iDay);
; if iMonth=12 then
; begin
; ; iMonth :=1;
; ; inc(iYear);
; end
; else inc(iMonth);
; dTemp2 :=StrToDateTime(IntToStr(iYear)+'-'+IntToStr(iMonth)+'-01 01:01:01');
; result :=round(dTemp2-dTemp1); //这个地方可扩展为小时,秒...只是加以计算即可
end;