ScriptCore3.EncodeDate

From Soldat Community Wiki
Revision as of 09:58, 25 August 2013 by Mighty (talk | contribs) (Example)
Jump to: navigation, search
function EncodeDate(Year, Month, Day: Word): TDateTime;
 Year: Year to be encoded
 Month: Month to be encoded
 Day: Day to be encoded
 Result: TDateTime depending on provided Year, Month and Day

Description

This function allows to convert given Year, Month and Day into a TDateTime format.
Note that arguments are not decimal numbers, if you want to use decimals as arguments, use TryEncodeDate.

Example

var
  y,m,d: Word;
  currdate: TDateTime;
begin
  // today (for me) it's 25th August 2013
  y := 2013;
  m := 8;
  d := 25;
  
  currdate := EncodeDate(y,m,d);
  WriteLn(FormatFloat('0',currdate));
  // 41511
end.