[Lazarus] DateDif function needed

John Landmesser JohnML at online.de
Sat Nov 9 15:45:09 CET 2013


On 09.11.2013 14:32, leledumbo wrote:
> 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 at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

please test your code: 21.12.2010(!!)   01.01.2013

My code is wrong too in this case :--((






More information about the Lazarus mailing list