今天16号+?天=下个月1号;
月的天数=今天的号吗+?天-1;
function GetMonthday:integer;
var
i,today:integer;
temp:Tdatetime;
begin
today:=inttostr(fotmatdatetime('d',now()));
for i:=0 to 31 do begin
temp:=now();
temp:=temp+1;
if inttostr(formatedatetime('d',temp))=1 then break;
end;
result:=today+i-1;
end;
月的天数=今天的号吗+?天-1;
function GetMonthday:integer;
var
i,today:integer;
temp:Tdatetime;
begin
today:=inttostr(fotmatdatetime('d',now()));
for i:=0 to 31 do begin
temp:=now();
temp:=temp+1;
if inttostr(formatedatetime('d',temp))=1 then break;
end;
result:=today+i-1;
end;
dateutils函数
daysinamonth
var
MyMonth,MyYear,MyDay: Word;
MyDayTable:TDayTable;
tmpBool : Boolean;
begin
DecodeDate(ADate, MyYear,MyMonth, MyDay);
tmpBool := IsLeapYear(MyYear);
MyDayTable := MonthDays[tmpBool];
Result := MyDayTable[MyMonth];
end;procedure TForm1.Button3Click(Sender: TObject);
var
MyDate : TDateTime;
tmpStr : String;
tmpInt : Integer;
begin
MyDate :=strtodate('02/10/2002');//在这里可以输入你的日期
tmpStr := FormatDateTime('mmmm yyyy',MyDate);
tmpInt := DaysInMonth(MyDate);
ShowMessage(tmpStr + '有 ' + IntToStr(tmpInt) + '天');
end;