Unit 'DateUtils' Package
[Overview][Constants][Classes][Procedures and functions][Index] [#rtl]

NthDayOfWeek

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

Declaration

Source position: dateutil.inc line 400

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

EncodeDateMonthWeek

  

Encodes a year, month, week of month and day of week to a TDateTime value.

#rtl.sysutils.DayOfWeek

  

Returns the day of the week.

DecodeDayOfWeekInMonth

  

Decode a TDateTime value in year, month, day of week parts.

EncodeDayOfWeekInMonth

  

Encodes a year, month, week, day of week specification to a TDateTime value.

TryEncodeDayOfWeekInMonth

  

Encode a year, month, week, day of week triplet to a TDateTime value.

Example

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.

Documentation generated on: Dec 10 2024