RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.DecodeDayOfWeekInMonth Function

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.

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

DateUtils

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 to 12, inclusive. 

ANthDayOfWeek indicates the count for the day of the week represented by AValue. For example, if AValue represents the 2nd 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 4 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.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!