title: Calculate Days Between Two Dates
body: <p>Please help me find days between two dates.</p>
  
  <p>I have two objects TDBDateEdit date1 and date2.</p>
  
  <pre><code>procedure Torder_form.date2Click(Sender: TObject);
  var d3: TDateTime;
  begin 
      d3:=date2.date - date1.date;
      showmessage(datetostr(d3));
  end.
  </code></pre>
  
  <p>I put to <code>date1 = 07.10.2015</code></p>
  
  <p>to <code>date2 - 15.11.2015</code></p>
  
  <p>Result must be: <code>39</code></p>
  
  <p>But program gives me result: <code>07.02.1900</code></p>
  
  <hr>
  
  <p>I found DaysBetween function. and I changed my codes like that</p>
  
  <pre><code>procedure Torder_form.date2Click(Sender: TObject);
  var d3: TDateTime;
  begin 
      d3:=DaysBetween(date2.date,date1.date);
      showmessage(datetostr(d3));
  end.
  </code></pre>
  
  <p>But programs says Result: <code>07.02.1900</code></p>