Difference between revisions of "ScriptCore3.EncodeDate"

From Soldat Community Wiki
Jump to: navigation, search
m (Example)
m (Description)
 
Line 7: Line 7:
 
==Description==
 
==Description==
 
This function allows to convert given ''Year'', ''Month'' and ''Day'' into a [[TDateTime]] format.<br>
 
This function allows to convert given ''Year'', ''Month'' and ''Day'' into a [[TDateTime]] format.<br>
Note that arguments are '''not''' decimal numbers, if you want to use decimals as arguments, use {{link|ScriptCore3|TryEncodeDate}}.
+
Note that arguments are '''not''' decimal numbers.
  
 
==Example==
 
==Example==

Latest revision as of 11:07, 25 August 2013

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.

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.