Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate the age
Message
From
14/09/2004 14:05:25
 
 
To
14/09/2004 13:24:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00941958
Message ID:
00942016
Views:
26

All 1,1,1. What should they be?
Cetin


Difficult to answer.
It depends on what is a month.

But, it puts these issues on the carpet:

What I can make with the tern oAge.Years,oAge.Months,oAge.Days ?
I can confront two Age? Not
I can return to the birth date? Not.

Then the issue is badly mail.
Reason? Loss of information in the calculation.

Add another property : LostDays ( Days lost for the change month )

Or add LostDays value to the Days value.

Example:
CLEAR

oAge = createobject('Age')
ldBirth = {^1961/1/19}
ldTarget = date() && How old is he today.
oAge.CalcAge(ldBirth, ldTarget)
oAge.LostDays = 0
? GOMONTH(m.ldTarget,-(12*oAge.Years+oAge.Months))-oAge.Days-oAge.lostDays

oAge.CalcAge({^2003/1/29}, {^2003/3/1})
oAge.lostDays = 2
? GOMONTH({^2003/3/1},-(12*oAge.Years+oAge.Months))-oAge.Days-oAge.lostDays

oAge.CalcAge({^2003/1/30}, {^2003/3/1})
oAge.lostDays = 1
? GOMONTH({^2003/3/1},-(12*oAge.Years+oAge.Months))-oAge.Days-oAge.lostDays

oAge.CalcAge({^2003/1/31}, {^2003/3/1})
oAge.lostDays = 0
? GOMONTH({^2003/3/1},-(12*oAge.Years+oAge.Months))-oAge.Days-oAge.lostDays

Define Class age As Relation
  Years=0
  Months=0
  Days=0
  lostDays=0
...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform