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. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus