# Board index » delphi » Date/Time and Present Value Functions

## Date/Time and Present Value Functions

Does anyone know a good source for a function similar to the
DateDiff() fuction in VB that returns the number of days between
two dates?

Also, where can I find a fuction to calcualte Present Value of a
string of cash flows at a given discount rate?

Thanks

## Re:Date/Time and Present Value Functions

In article <4b9srv\$...@news1.mnsinc.com>,
Chip Mayer  <c...@applogic.com> wrote:
:Also, where can I find a fuction to calcualte Present Value of a
:string of cash flows at a given discount rate?

Try

303775 May 1 1991 ftp://garbo.uwasa.fi/pc/turbopas/nrpas13.zip
nrpas13.zip Numerical Recipes Pascal shareware version, 303K!

But the task is not overly complicated. The formula for NPV is
presented in any good textbook on capital investments and/or
business finance. All you'll need is summation and exponentation.

All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi archives  193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
t...@uwasa.fi http://uwasa.fi/~ts BBS 961-3170972; FIN-65101,  Finland

## Re:Date/Time and Present Value Functions

##### Quote
Chip Mayer <c...@applogic.com> wrote:
>Does anyone know a good source for a function similar to the
>DateDiff() fuction in VB that returns the number of days between
>two dates?

>Also, where can I find a fuction to calcualte Present Value of a
>string of cash flows at a given discount rate?

>Thanks

Using:
V for present value
D for a constant payment
r for the constant per period interest rate
n for the number of periods
P for a balloon payment at the end of n periods

V = (D/r)*(1 - 1/(1+r)^n) + P/(1+r)^n

If the payments are not constant you can sum a series.

If you have problems with this, ask for some more help.

Bob.