How To Calculate a Person's Current Age (124327)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft FoxPro for Windows 2.6a
  • Microsoft FoxPro for MS-DOS 2.6a
  • Microsoft FoxPro for Macintosh 2.6a

This article was previously published under Q124327

SUMMARY

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.

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbcode KB124327