This works for me.
Thanks  

Bryant

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Vince Teachout
Sent: Tuesday, March 27, 2007 11:56 PM
To: ProFox Email List
Subject: Re: Date calculations.

Bryant Minard wrote:
> If I have variable (d = 397, the difference between two dates), how 
> can I show that in years, months and days? (example 1 year, 1 month 
> and 1 day) Has anyone written a function to do something like this?
>   

Here's how I'd do it:

VerboseDate(397)


FUNCTION verbosedate
 LPARAMETERS nTotDays

LOCAL nyears, nmonths, ndays, nRemain

    nyears = nTotdays/365.25
    nRemain = nYears - INT(nYears)
    nmonths = nRemain*12
    nRemain = nMonths - INT(nMonths)
    nDays = (nRemain*365.25)/12

    nYears = INT(nYears)
    nMonths = INT(nMonths)
    nDays = INT(nDays)

    ? nYears, nMonths, nDays

RETURN
ENDFUNC


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to