How do I calculate the number of days between 2 dates?

How can I calculate the number of days between two dates? The function DaysBetween does not seem to be i9n the library. Thanks

This topic was automatically closed after 24 hours. New replies are no longer allowed.

See http://www.delphibasics.co.uk/RTL.asp?Name=DaysBetween for samples

Thanks but I get function not found when I save the script and the library ‘dateutils’ is not found.

At the top of the script, add this:

uses DateUtils;

// UserMain
// This script contains special functions related to some of the events triggered by the publication.
// You can then optionally add new commands.

uses Classes;
uses SysUtils;
uses DateUtils;

Produces:

Error in script:
INTERNAL ERRORLibrary ‘DateUtils’ not found

Looks like the library is not available by default. We’ll add it to next update.

Try to subtract the two dates: nbdays = DT1 - DT2 for instance

Thanks support