TIniFile.WriteDateTime

From Soldat Community Wiki
Revision as of 01:03, 23 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
procedure WriteDateTime(const Section, Ident: String; Value: TDateTime)
 Section: Section name
 Ident: Property name (key)
 Value: Value to be assigned to a key

Description

This procedure updates an existing key's value or creates a new one.
Note that even though Value is a Double, DateTime written into an ini is in a YYYY-MM-DD HH:NN format.

Example

Example adds a new (useless) key to soldat.ini

const
  // assuming Sandbox Level < 2
  PATH = 'soldat.ini';

var
  Ini: TIniFile;

begin
  Ini := File.CreateINI(PATH);
  Ini.WriteDateTime('BOTS','CurrDateAndTime',Now());
  Ini.UpdateFile;
  Ini.Free;
end.