TryEncodeDateTime
Encode a Year, Month, Day, Hour, minute, seconds, milliseconds tuplet to a TDateTime value
Declaration
Source position: dateutil.inc line 306
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) : Boolean;
Description
EncodeDateTime encodes the values AYearAMonth, 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
Name | Description |
---|---|
EncodeDateDay | Encodes a year and day of year to a TDateTime value |
EncodeDateMonthWeek | Encodes a year, month, week of month and day of week to a TDateTime value |
EncodeDateTime | Encodes a TDateTime value from all its parts |
EncodeDateWeek | Encode a TDateTime value from a year, week and day of week triplet |
TryEncodeDateDay | Encode a year and day of year to a TDateTime value |
TryEncodeDateMonthWeek | Encode a year, month, week of month and day of week to a TDateTime value |
TryEncodeDateWeek | Encode a year, week and day of week triplet to a TDateTime value |
Example
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.