Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accurately calculating a persons age
Message
From
25/10/2004 05:26:25
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00953701
Message ID:
00954196
Views:
21
hi

i make new prg. i put your function at myprg moh.prg
as under , i make all steps but i get error message (Variable "moh" is not found )
*? CalcAge(DATE(1965, 4, 26), DATE(2004,4,27))

FUNCTION CalcAge(b_day, to_date)
  LOCAL fmnts, smnts
  fmnts = YEAR(b_day)  *12+MONTH(b_day)

  IF MONTH(to_date) == MONTH(b_day) .AND.; && If The day is smaller then day of birthday the person has not complete full year
     DAY(to_date)   <  DAY(b_day)
     smnts = YEAR(to_date)*12+(MONTH(to_date)-1)
  ELSE
     smnts = YEAR(to_date)*12+MONTH(to_date)
  ENDIF

RETURN INT((smnts-fmnts)/12)
Previous
Reply
Map
View

Click here to load this message in the networking platform