[Lazarus] DateDif function needed

Anthony Tekatch anthony at unihedron.com
Fri Nov 8 21:53:58 CET 2013


On Fri, 08 Nov 2013 21:35:45 +0100, John Landmesser <JohnML at online.de> wrote:

> Hi List,
> 
> i'm searching a pascal datetime function that simulates an Excel 
> function: "DateDif"
> 
> Excel for example knows the function DateDif that returns the number of 
> Years, month and days between Date1 and date2.
> 
> Date1 := 21.12.2012
> Date2 := 01.01.2013
> 
> Result would be: 0 years, 0 moths, 11 days

Try the DaysBetween function::
  http://www.freepascal.org/docs-html/rtl/dateutils/daysbetween.html

But, I am not sure how you will deal with "months between" unless you settle
on 31 days per month.



More information about the Lazarus mailing list