Show: Delphi C++
Display Preferences


From RAD Studio API Documentation
Jump to: navigation, search


procedure DecodeDayOfWeekInMonth(const AValue: TDateTime; out AYear, AMonth, ANthDayOfWeek, ADayOfWeek: Word);


extern DELPHI_PACKAGE void __fastcall DecodeDayOfWeekInMonth(const System::TDateTime AValue, /* out */ System::Word &AYear, /* out */ System::Word &AMonth, /* out */ System::Word &ANthDayOfWeek, /* out */ System::Word &ADayOfWeek);


Type Visibility Source Unit Parent
System.DateUtils System.DateUtils


For a given TDateTime value, returns the year, month, day of the week, and the count of that day of the week in the month.

For a given TDateTime value, DecodeDayOfWeekInMonth returns the day of the week and, for that day of the week, which occurrence it is within the month.

AValue is the date/time value about which you want information.

AYear returns the year that AValue represents.

AMonth returns the month in which AValue occurs. This value can be from 1 through 12, inclusive.

ANthDayOfWeek indicates the count for the day of the week represented by AValue. For example, if AValue represents the second Tuesday of the month, ANthDayOfWeek returns 2. Note that this value may differ from the value that the WeekOfTheMonth function returns, because DecodeDayOfWeekInMonth 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, DecodeDayOfWeekInMonth returns 1 as the value of ANthDayOfWeek, while WeekOfTheMonth returns 5 (or maybe 4), indicating the last week of the previous month.

ADayOfWeek returns the day of the week that AValue represents, where 1 Monday and 7 is Sunday.

Note: The definition for ADayOfWeek follows the ISO 8601 standard.
Tip: To make the ADayOfWeek value more readable, use the day of week constants.

See Also

Code Examples

Personal tools
In Other Languages
Previous Versions