Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accurately calculating a persons age
Message
De
25/10/2004 05:26:25
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00953701
Message ID:
00954196
Vues:
22
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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform