MonthDays常量保存每个月有多少天,类型如下:
Type PDayTable = ^TDayTable;
Type TDayTAble= Array[1..12] of Word;
Const MonthDays:array of[Boolean] of TDayTable;
Type PDayTable = ^TDayTable;
Type TDayTAble= Array[1..12] of Word;
Const MonthDays:array of[Boolean] of TDayTable;
Days:Integer; Days:=Abs(Trunc(Day2)-Trunc(Day1));
用下月一号-当月一号
const
Days:array[1..12] of integer = ('31','28','31','30','31','30','31','31','30','31','30','31');
begin
if (IsLeapYear(iYear)) and (iMonth=2) then
Result:=Days[iMonth]+1
else
Result:=Days[iMonth];
end;
我试着写写:
function GetDays(y,m:integer):integer;
var
i,Wy,Wm,Wr:integer;
Workdate:tdate;
begin
i:=1;
if (y<0) or (m<0) then
begin
result:=-1;
exit;
end;
encodedate(workdate,y,m,1);
Wm:=m;
while Wm=m do
begin
inc(i);
incday(workdate);
decodedate(workdate,wy,wm,wr);
end;
result:=i;
end;
function GetMonthDays(iYear,iMonth:integer):integer;
const
Days:array[1..12] of integer = (31,28,31,30,31,30,31,31,30,31,30,31);
begin
if (IsLeapYear(iYear)) and (iMonth=2) then
Result:=Days[iMonth]+1
else
Result:=Days[iMonth];
end;
DaysInAMonth(2002,2)
D6哪有daysinamonth这个函数阿?