How To Calculate a Person's Current Age

ID: Q124327

2.60a 3.00 | 2.60a | 2.60a

WINDOWS    | MS-DOS | MACINTOSH

The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft Foxpro for Windows, version 2.6a
  • Microsoft Foxpro for MS-DOS, version 2.6a
  • Microsoft Foxpro for Macintosh, version 2.6a

To calculate a person's current age, enter the following commands in the Command window:

   m.DOB = {12/03/62}
   m.age = ROUND(((DATE() - m.DOB) / 365.25),0)
   ? m.age

NOTES: The value 365.25 accounts for leap years, and the question mark tells FoxPro to print the age to the screen. You may need to minimize open windows to see the printed value.

Additional reference words: VFoxWin 3.00 FoxWin FoxDos FoxMac 2.60a birthday birthdate KBCategory: KBSubcategory: FxprgGeneral

Keywords          : kbcode FxprgGeneral 
Version           : 2.60a 3.00 | 2.60a | 2.60a
Platform          : MACINTOSH MS-DOS WINDOWS


Last Reviewed: May 22, 1998
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.