I
import
Unregistered / Unconfirmed
GUEST, unregistred user!
function WeekofYear(Date: TDate): integer; var
FirstDay, FirstWeekEnd, NowWeekEnd: TDate;
Year, Month, Day: word;
begin
DecodeDate(Date, Year, Month, Day);
FirstDay := EncodeDate(Year, 1, 1);
FirstWeekEnd := FirstDay + 7 - DayofWeek(FirstDay);
NowWeekEnd := Date + 7 - DayofWeek(Date);
Result := Round(NowWeekEnd - FirstWeekEnd) div 7 + 1;
end;
FirstDay, FirstWeekEnd, NowWeekEnd: TDate;
Year, Month, Day: word;
begin
DecodeDate(Date, Year, Month, Day);
FirstDay := EncodeDate(Year, 1, 1);
FirstWeekEnd := FirstDay + 7 - DayofWeek(FirstDay);
NowWeekEnd := Date + 7 - DayofWeek(Date);
Result := Round(NowWeekEnd - FirstWeekEnd) div 7 + 1;
end;