Difference between revisions of "ScriptCore3.EncodeDate"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m (Example)
Line 16: Line 16:
 
begin
 
begin
 
   // today (for me) it's 25th August 2013
 
   // today (for me) it's 25th August 2013
   y := 2013
+
   y := 2013;
 
   m := 8;
 
   m := 8;
 
   d := 25;
 
   d := 25;

Revision as of 10:58, 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, 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.