This is a function I wrote to return an integer value for the calculated minutes between
two date/time fields.  I am writing a statistical graphing program for my Support department,
and needed to find the actual resolution time for each call.  Part of this procedure required
my knowing how many minutes were between the start and stop date/time field.  I was
unable to find anything in any books that we have and the help files about doing this, so 
I wrote this function.

Heres how it works:

**************************************

 for i := 1 to stats_frm.query3.recordcount do
      begin
         CurID := stats_frm.query3.fields[0].AsInteger;
         D1 := stats_frm.query3.fields[1].AsDateTime;  {assign start date/time from query}
         D2 := stats_frm.query3.fields[2].AsDateTime;  {assign end date/time from query}
         D3 := D2 - D1;				   {get difference between date/times}
         DVal := DateVal(D3);				   {call the function}
         if CurID = BegID then .....


{/**  Here's the function that D3 is passed to **/}

function DateVal(D3: tDateTime): Integer;
var
   DDay, DHrs, DMin, DSec: Integer;
   Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
   DecodeDate(D3, Year, Month, Day);
   DecodeTime(D3, Hour, Min, Sec, MSec);
   DDay := (Day * 24 * 60);
   DHrs := (Hour * 60);
   DMin := Min;
   If Sec > 30 then
      begin
         Sec := 1;
      end
   else
      begin
         Sec := 0;
      end;
   DSec := Sec;
   DateVal := (DDay + DHrs + DMin + DSec);
end;

{The value it returns is an integer.  The value is rounded up or down depending on the
seconds.}  

************************************


If you can use this function, be my guest.  If you can improve upon it, please email me
with your improved code.

 