一个简单的工作日计算:
function getWorkDay(dtBegin:TDateTime;IncDays:Integer):TDateTime; const days: array[1..7] of string=(‘7‘,‘1‘,‘2‘,‘3‘,‘4‘, ‘5‘,‘6‘); var week1:string; x:integer; begin //日期 x:=1; while (x<=IncDays) do begin //判断是否周末 week1:=days[DayOfWeek(dtBegin)]; //今日周几 if (week1=‘6‘) or (week1=‘7‘) then dtBegin:=dtBegin+1; //日期增加 dtBegin:=dtBegin+1; x:=x+1; end; Result:=dtBegin; end;
时间: 2024-12-11 15:54:38