Home  |  Delphi .net Home  |  System.TimeSpan  |  Subtract Method
  
Subtract  
Method  
Subtracts a TimeSpan from the current TimeSpan
TimeSpan Structure
System NameSpace
CF1.  Function Subtract ( Value : TimeSpan ) : TimeSpan;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns a new TimeSpan whose value is the current TimeSpan less the Value TimeSpan.
Microsoft MSDN Links
System
System.TimeSpan
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  span1, span2, span3 : TimeSpan;

begin
  span1 := System.TimeSpan.Create(8, 30, 0);  //  8 hours 30 mins 0 secs
  span2 := System.TimeSpan.Create(11, 0, 0);  // 11 hours  0 mins 0 secs

  span3 := span2.Subtract(span1);

  Console.WriteLine('span1 = {0}', span1);
  Console.WriteLine('span2 = {0}', span2);
  Console.WriteLine('span3 = {0}', span3);

  Console.ReadLine;
end.
   span1 = 08:30:00
   span2 = 11:00:00
   span3 = 02:30:00
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author