Formula for a column or how do I do it lazarus / 16-Databases ---------------------------------------------------------------------- Thomas Colvin · 2017-05-02 17:40 Am making a table. One column is my salesman's name the next what city he is working the next the product he is doing the next is the date he was there (using date like 05/02/2017) and the next column is the date he went back. Now what I want is the next column to say how many days between his visits. In Excel the formula is cell1 in column B minus cell1 in column A. And I set column C cell1 to number and it show the number of days. But what do I do in Delphi to make my column show the days between visits? Thomas ---------------------------------------------------------------------- RAW · 2017-05-02 18:27 Take a look at TDateTime... There are a lot of examples out there. TDateTime is DOUBLE I guess and so you can easily calculate the difference between two dates... ---------------------------------------------------------------------- valdir.marcos · 2017-05-02 18:46 Maybe this example helps: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  ..., dateutils; procedure TForm1.Button1Click(Sender: TObject);var  BeginDate, EndDate: TDate;  WorkedDays: Integer;begin  BeginDate := StrToDate('01/01/2017');  EndDate   := Now;  WorkedDays := DaysBetween(EndDate, BeginDate);  ShowMessage('WorkedDays: ' + IntToStr(WorkedDays));end; ---------------------------------------------------------------------- RAW · 2017-05-02 19:17 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure TForm1.FormClick(Sender: TObject);  Var   Date1,   Date2: TDateTime;   iDays: Integer; Begin  Date1:= StrToDate('25.10.2000');  Date2:= Now;   iDays:= Trunc(Date2-Date1); // Round results in 1 day more :-)   ShowMessage(IntToStr(iDays));  ShowMessage(IntToStr(DaysBetween(Date2, Date1))); End;   There is also DAYSPAN... maybe interesting too...