Show: Delphi C++
Display Preferences

System.DateUtils.TryEncodeDayOfWeekInMonth

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function TryEncodeDayOfWeekInMonth(const AYear, AMonth, ANthDayOfWeek, ADayOfWeek: Word; out AValue: TDateTime): Boolean;

C++

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

Properties

Type Visibility Source Unit Parent
function public
System.DateUtils.pas
System.DateUtils.hpp
System.DateUtils System.DateUtils

Description

Calculates a TDateTime that represents a specified occurrence of a day of the week within a specified month and year.

TryEncodeDayOfWeekInMonth returns a TDateTime for the date specified by the AYear, AMonth, ANthDayOfWeek, 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 from 1 through 9999 (inclusive).

AMonth is the month. It can be any value from 1 through 12 (inclusive).

ANthDayOfWeek indicates the occurrence for the day of the week represented by ADayOfWeek. It can be any value from 1 through 5 (inclusive), as long as this value specifies a valid date. For example, if a month does not include five Mondays, setting ANthDayOfWeek to 5 and ADayOfWeek to 1 causes TryEncodeDayOfWeekInMonth to return False.

ADayOfWeek is the day of the week, where 1 is Monday and 7 is Sunday.

TryEncodeDayOfWeekInMonth returns True if AYear, AMonth, ANthDayOfWeek, and ADayOfWeek represent a valid date, and False if this combination does not correspond to a valid date.

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
Assistance