Sign in Join
FPDoc Onlineexperiment

NthDayOfWeek function

In unit DateUtils

Calculate which occurrence of weekday in the month a given day represents.

Declaration

pascal
function NthDayOfWeek(const AValue: TDateTime): Word

Arguments

AValue

Date to check.

Function result

Occurrence of weekday in the month of AValue.

Description

NthDayOfWeek returns the occurrence of the weekday of AValue in the month. This is the N-th time that this weekday occurs in the month (e.g. the third Saturday of the month).

See also

Example: ex104

pascal
Program Example104;

{ This program demonstrates the NthDayOfWeek function }

Uses SysUtils,DateUtils;

Begin
  Write('Today is the ',NthDayOfWeek(Today),'-th ');
  Writeln(formatdateTime('dddd',Today),' of the month.');
End.

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