Sign in Join
FPDoc Onlineexperiment

WeeksInAYear function

In unit DateUtils

Returns the number of weeks in a given year.

Declaration

pascal
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.

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

Example: ex13

pascal
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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.