WeeksInYear
return the number of weeks in the year, given a date
Declaration
Source position: dateutil.inc line 96
function WeeksInYear(const AValue: TDateTime) : Word;
Description
WeeksInYear returns the number of weeks in the year part of AValue. The return value is either 52 or 53.
Remark
The first week of the year is determined according to the ISO 8601 standard: It is the first week that has at least 4 days in it, i.e. it includes a Thursday. !!!
See also
Name | Description |
---|---|
DaysInAMonth | Number of days in a month of a certain year. |
DaysInAYear | Number of days in a particular year. |
DaysInMonth | Return the number of days in the month in which a date occurs. |
DaysInYear | Return the number of days in the year in which a date occurs. |
WeeksInAYear | Return the number of weeks in a given year |
Example
Program Example12;
{ This program demonstrates the WeeksInYear function }
Uses SysUtils,DateUtils;
Var
Y : Word;
Begin
For Y:=1992 to 2010 do
Writeln(Y,' has ',WeeksInYear(EncodeDate(Y,2,1)),' weeks.');
End.