TryEncodeDateMonthWeek function
Encode a year, month, week of month and day of week to a
TDateTime value.
Declaration
function TryEncodeDateMonthWeek(const AYear: Word; const AMonth: Word;
const AWeekOfMonth: Word;
const ADayOfWeek: Word;
out AValue: TDateTime): BooleanArguments
AYear | Year. |
AMonth | Month in the year. |
AWeekOfMonth | Week in the month. |
ADayOfWeek | Day in the week. |
AValue | Encoded
|
Function result
True if the encoding was successful,
False if not.Description
TryEncodeDateTime encodes the values
AYear
AMonth,
WeekOfMonth,
ADayOfWeek,
to a date value and returns this value in
AValue.
If the encoding was successful, True is returned, False
if any of the arguments is not valid.
See also
- DecodeDateMonthWeek
- EncodeDateTime
- EncodeDateWeek
- EncodeDateDay
- EncodeDateMonthWeek
- TryEncodeDateTime
- TryEncodeDateWeek
- TryEncodeDateDay
- NthDayOfWeek
Example: ex86
Program Example86;
{ This program demonstrates the TryEncodeDateMonthWeek function }
Uses SysUtils,DateUtils;
Var
Y,M,Wom,Dow : Word;
TS : TDateTime;
Begin
DecodeDateMonthWeek(Now,Y,M,WoM,DoW);
If TryEncodeDateMonthWeek(Y,M,WoM,Dow,TS) then
Writeln('Today is : ',DateToStr(TS))
else
Writeln('Invalid year/month/week/dow indication');
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
