Home  |  Delphi .net Home  |  System.DateTime  |  AddMilliseconds Method
AddMilliseconds  
Method  
Adds a number of milliseconds to the date/time
DateTime Structure
System NameSpace
CF1.  Function AddMilliseconds ( Milliseconds : Double; ) : DateTime;
CF : Methods with this mark are Compact Framework Compatible
Description
Adds a number of Milliseconds to the current object datetime, returning the result.
 
You can subtract by specifying a negative number, or using the Subtract method.
Notes
Like a lot of datetime methods, the datetime object itself is not affected - the modified datetime is returned for assignment.
Microsoft MSDN Links
System
System.DateTime
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  time : DateTime;

begin
  time := Datetime.Create(2004, 6, 20, 08, 30, 0);  // 08:30 on June 20 2004

  Console.WriteLine('Time at the start             = {0:F}', time);

  time := time.AddMilliseconds(75000);   // 75 seconds : 1 minute 15 seconds

  Console.WriteLine('With 75000 milliseconds added = {0:F}', time);

  Console.ReadLine;
end.
Show full unit code
  Time at the start             = 20 June 2004 08:30:00
  With 75000 milliseconds added = 20 June 2004 08:31:15
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author