Difference between revisions of "ScriptCore3.EncodeTime"

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

Revision as of 10:08, 25 August 2013

function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
 Hour: Hours to be encoded
 Min: Minutes to be encoded
 Sec: Seconds to be encoded
 MSec: Miliseconds to be encoded
 Result: TDateTime depending on provided arguments

Description

This function allows to convert given Hour, Min, Sec and MSec into a TDateTime format.
Note that arguments are not decimal numbers.

Example

var
  h,m,s: Word;
  currtime: TDateTime;
begin
  // it's 10:57:24 at the moment.

  h := 10;
  m := 57;
  s := 24;
  
  currtime := EncodeTime(h,m,s,0);
  WriteLn(FormatFloat('0.#########',currtime));
  // 0.456527778
end.