TryEncodeDateTime function
Encode a Year, Month, Day, Hour, minute, seconds, milliseconds tuplet to a
TDateTime value.
Declaration
function TryEncodeDateTime(const AYear: Word; const AMonth: Word;
const ADay: Word; const AHour: Word;
const AMinute: Word; const ASecond: Word;
const AMilliSecond: Word;
out AValue: TDateTime): BooleanArguments
AYear | Year. |
AMonth | Month in year. |
ADay | Day in month. |
AHour | Hour of the day. |
AMinute | Minutes in the hour. |
ASecond | Seconds in the minute. |
AMilliSecond | Millisecond in the second. |
AValue | Encoded
|
Function result
True if the encoding was successful.Description
EncodeDateTime encodes the values
AYear
AMonth,
ADay,
AHour,
AMinute,
ASecond and
AMilliSecond
to a date/time value and returns this value in
AValue.
If the date was encoded successfully, True is returned,
False is returned if one of the arguments is not valid.
See also
- EncodeDateTime
- EncodeDateMonthWeek
- EncodeDateWeek
- EncodeDateDay
- TryEncodeDateDay
- TryEncodeDateWeek
- TryEncodeDateMonthWeek
Example: ex80
Program Example79;
{ This program demonstrates the TryEncodeDateTime function }
Uses SysUtils,DateUtils;
Var
Y,Mo,D,H,Mi,S,MS : Word;
TS : TDateTime;
Begin
DecodeDateTime(Now,Y,Mo,D,H,Mi,S,MS);
If TryEncodeDateTime(Y,Mo,D,H,Mi,S,MS,TS) then
Writeln('Now is : ',DateTimeToStr(TS))
else
Writeln('Wrong date/time indication');
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
