[Lazarus] DateDif function needed

leledumbo leledumbo_cool at yahoo.co.id
Sat Nov 9 14:32:42 CET 2013


Indeed that was wrong, I shouldn't exploit the internal details. Below is the
correct one (still no need for that complicated code of yours):

uses 
  SysUtils,DateUtils; 
var 
  Date1,Date2: TDate; 
  Y,M,D: Word; 
begin 
  Date1 := EncodeDate(2012,12,21); 
  Date2 := EncodeDate(2013,01,01);
  Y := YearsBetween(Date1,Date2);
  M := MonthsBetween(Date1,Date2);
  D := DaysBetween(Date1,Date2);
  WriteLn(Y,'-',M,'-',D);
end. 




--
View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-DateDif-function-needed-tp4034182p4034192.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.




More information about the Lazarus mailing list