[Overview][Constants][Procedures and functions][Index] | Reference for unit 'DateUtils' (#rtl)

# WeeksInAYear

Return the number of weeks in a given year

## Declaration

Source position: dateutil.inc line 110

`function WeeksInAYear(`
`const AYear: Word`
`):Word;`

## Arguments

`AYear` |  | A (valid) year.

## Function result

Number of weeks in AYear

## Description

WeeksInAYear returns the number of weeks in the year AYear. 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

WeeksInYear |  | return the number of weeks in the year, given a date
DaysInYear |  | Return the number of days in the year in which a date occurs.
DaysInAYear |  | Number of days in a particular year.
DaysInMonth |  | Return the number of days in the month in which a date occurs.
DaysInAMonth |  | Number of days in a month of a certain year.

## Example

    Program Example13;

    { This program demonstrates the WeeksInAYear function }

    Uses SysUtils,DateUtils;

    Var
      Y : Word;

    Begin
      For Y:=1992 to 2010 do
        Writeln(Y,' has ',WeeksInAYear(Y),' weeks.');
    End.

Documentation generated on: May 14 2021