How to determine the difference between two dates?
Author Message How to determine the difference between two dates?

Is there a function in Microsoft FoxPro 5.0 that will allow me determine
the difference in years between two given dates.  If so, what is the
name of this function?  If not, how can I go about doing this?  It can
be easily done in Visual Basic with the DateDiff function.  Any
suggestions or help would be greatly appreciated.

Matt Ricciardi

Tue, 16 Nov 1999 03:00:00 GMT  How to determine the difference between two dates?

You can subtract two dates and get the difference in days. You can
then divide by 365 - that does everything but take into account leap
years.

Are you looking for someone's age or what?

On Fri, 30 May 1997 16:55:40 -0400, "Matthew J. Ricciardi"

Quote:

>Is there a function in Microsoft FoxPro 5.0 that will allow me determine
>the difference in years between two given dates.  If so, what is the
>name of this function?  If not, how can I go about doing this?  It can
>be easily done in Visual Basic with the DateDiff function.  Any
>suggestions or help would be greatly appreciated.

>Matt Ricciardi

Wed, 17 Nov 1999 03:00:00 GMT  How to determine the difference between two dates?

Use date arithmetic:

Date1 = DATE()
Date2 = {5/30/1997}
? Date1 - Date2

--
Richard Seymour, Anarchy Software, Inc.

http://www.wavetech.net/~anarchy

Quote:
> Is there a function in Microsoft FoxPro 5.0 that will allow me determine
> the difference in years between two given dates.  If so, what is the
> name of this function?  If not, how can I go about doing this?  It can
> be easily done in Visual Basic with the DateDiff function.  Any
> suggestions or help would be greatly appreciated.

> Matt Ricciardi

Wed, 17 Nov 1999 03:00:00 GMT  How to determine the difference between two dates?

If you have two dates, A and B, you can subtract them to get the number of
days elasped.  C = B - A.
From here you can get the number of years by dividing by 365
D = C / 365
Continue this logic to get any date difference information you require.

Wed, 17 Nov 1999 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages