Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate the age
Message
From
14/09/2004 19:39:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/09/2004 14:05:25
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00941958
Message ID:
00942173
Views:
30
Yes difficult :( Loose definition of a month. From medical point for newborn days would be significant, then months, then days lose importance and just years.
Cetin

>
>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
>...
>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform