Число текущей недели 2
function WeekNum(const ADate: TDateTime): word;
var
Year: word;
Month: word;
Day: word;
begin
DecodeDate(ADate + 4 - DayOfWeek(ADate + 6), Year, Month, Day);
result := 1 + trunc((ADate - EncodeDate(Year, 1, 5) +
DayOfWeek(EncodeDate(Year, 1, 3))) / 7);
end;
|
|