RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.EncodeDateMonthWeek Function

Returns a TDateTime that represents a specified day of a specified week in a specified month and year.

Pascal
function EncodeDateMonthWeek(const AYear: Word; const AMonth: Word; const AWeekOfMonth: Word; const ADayOfWeek: Word): TDateTime;
C++
TDateTime EncodeDateMonthWeek(const Word AYear, const Word AMonth, const Word AWeekOfMonth, const Word ADayOfWeek);

DateUtils

EncodeDateMonthWeek returns a TDateTime for the date specified by the AYear, AMonth, AWeekOfMonth, and ADayOfWeek parameters. The time portion of the return value is 0 (Midnight at the start of the specified day). 

AYear is the year. It can be any value between 1 and 9999 (inclusive). 

AMonth is the month. It can be any value between 1 and 12 (inclusive). 

AWeekOfMonth is the week within that month, where 1 is the first week that includes four or more days. Note that if the first calendar day of the month is a Friday, Saturday, or Sunday, then those three days must be expressed using AMonth set to the previous month and AWeekOfMonth set to the number of weeks in the previous month. Similarly, if the last calendar day of the month is a Monday, Tuesday, or Wednesday, then those three days are expressed with AMonth set to the following month and AWeekOfMonth set to 1. 

ADayOfWeek is the day of the week, where 1 Monday, 2 is Tuesday, and so on.

Tip: To make the ADayOfWeek value more readable, use the Day of week constants.
If any of the parameters are not in range, EncodeDateMonthWeek raises an EConvertError exception.
Note: The definitions for AWeekOfMonth and ADayOfWeek reflect the ISO 8601 standard.
 

 

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