ScriptCore3.TryEncodeDate
function TryEncodeDate(Year, Month, Day: Word; var Date: TDateTime): Boolean; Year: Year to be encoded Month: Month to be encoded Day: Day to be encoded Date: Result of encoding Result: TRUE if encoding has been successfull
Description
This function is equivalent to EncodeDate, however, it allows to check whether encoding has been successfull or not.
Note that arguments are not decimal numbers.
Example
var
y,m,d: Word;
currdate: TDateTime;
begin
// today (for me) it's 25th August 2013
y := 2013;
m := 8;
d := 25;
if TryEncodeDate(y,m,d,currdate) then
WriteLn(FormatFloat('0',currdate));
// 41511
end.