试试这个函数!
Function CalcDayOfWeek(Year, Month, Day : Integer) : Integer;
Var
Century,
Holder : Integer;
begin
if (Year < 0) or (Month < 1) or (Month > 12) or (Day < 1) or (Day > 31) then
CalcDayOfWeek := -1
else
begin
Century := Year div 100;
Year := Year MOD 100;
if Month < 3 then
begin
Inc(Month, 12);
if Year > 0 then
Dec(Year, 1)
else
begin
Year := 99;
Dec(Century);
end;
end;
Holder := Day;
Holder := Holder + (((Month + 1) * 26) div 10);
Holder := Holder + Year;
Holder := Holder + (Year div 4);
Holder := Holder + (Century div 4);
Holder := Holder - Century - Century;
While Holder < 0 do
Inc(Holder, 7);
Holder := Holder MOD 7;
if Holder = 0 then
Holder := 7;
Dec(Holder);
CalcDayOfWeek := Holder;
end;
end;