function NthDayOfWeek(const AValue: TDateTime): Word;
extern DELPHI_PACKAGE System::Word __fastcall NthDayOfWeek(const System::TDateTime AValue);
Returns the weekday of the specified TDateTime value.
Note that this value may differ from the value that the WeekOfTheMonth function returns, because NthDayOfWeek counts every occurrence of the given weekday, while WeekOfTheMonth only counts a week if it includes four or more days in the month. Thus, for example, if AValue represents a Saturday that is the first day of a month, NthDayOfWeek returns 1, while WeekOfTheMonth returns 5 (or maybe 4), indicating the last week of the previous month.
Note: To obtain the year, month, and day of the week, as well as which occurrence of that day of the week the specified TDateTime represents, use the DecodeDayOfWeekInMonth function.