WeeksInAYear returns the number of weeks in the year specified by the parameter AYear. The range allowable is 1 through to 9999 inclusive.
WeeksInAYear defines the first week of the year according to the ISO 8601 standard, so the first week of the year is the one that includes the first Thursday of the year (the first week that has four or more days in the year). This means that WeeksInAYear always returns either 52 or 53.
Declaration: Function WeeksInAYear(const AYear: Word): Word;
An example follows.
procedure ScriptEvent(var Value:Variant);
var
TheYear, NumWeeks : word;
begin
TheYear := 2024;
NumWeeks := WeeksInAYear(TheYear);
LogInfo('Number of weeks is - '+IntToStr(NumWeeks));
NumWeeks := WeeksInAYear(TheYear+1);
LogInfo('Number of weeks is - '+IntToStr(NumWeeks));