function Get(YM:Integer
Week:Integer):Integer;Const Data :array [1..7] of Integer=(2,3,4,5,6,0,1);var D1,d2:TDate
I:Integer;begin Result:=0
D1:= EncodeDate(YM Div 100, YM Mod 100, 1)
D2:= IncMonth(D1,1)-1
I:= Trunc(D1)
While I<=Trunc(D2) Do Begin if (I Mod 7)= Data[Week] then begin Inc(Result)
Inc(I,7)
end else Inc(I, (Data[Week]+7 - (I Mod 7))Mod 7)
End;end;或者function Get(YM:Integer
Week:Integer):Integer;Const Data :array [1..7] of Integer=(2,3,4,5,6,0,1);var D1:TDate
First:Integer;begin D1:= EncodeDate(YM Div 100, YM Mod 100, 1)
First:= Trunc(D1) + ((Data[Week]+7 - (Trunc(D1) Mod 7)) Mod 7)
Result := ((Trunc( IncMonth(D1,1)-1 )-First) Div 7)+1;end;procedure TForm1.Button1Click(Sender: TObject);begin Caption:= inttostr(Get(200903,6))
//第二个参数为1..7end;