Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compute how many years,months,days
Message
From
28/10/2004 06:16:51
 
 
To
28/10/2004 05:40:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 5
Miscellaneous
Thread ID:
00955191
Message ID:
00955196
Views:
19
try with this procedure, but I haven't tested well so... :.)

procedure getYearMonthDay

Parameters a,b
*-- a = first date
*-- b = last date

NumYear = Year(b)-Year(a)
NumMonth = Month(b)-Month(a)
NumDay = Day(b) - Day(a)

If NumDay < 0
NumMonth = NumMonth - 1
Numday = (Gomonth(a,1)-Day(Gomonth(a,1)) - a )+ Day(b)
EndIf
If NumMonth < 0
NmYear = NumYear - 1
NumMonthi = Abs(NumMonth)
EndIf

? NumYear, NumMonth, NumDay

HTH
Alessio


>hi all,
>
>how i can compute at myform as ,
>i want to insert at (thisform.text1.value...DATE("1963/03/29"))
>(thisform.text2.value...DATE("2004/10/25"))
>
>result at thisform.text3.value=39 years
> thisform.text4.value=9 months
> thisform.text5.value=25 days
> or
>at thisform.text3.value=
> ex.. 39 9 25
>
>thanks.
>m.qasem year
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform