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