NextGen Knowledge Center

AGE Function

Use:Displays the age of the currently selected patient in the specified format as of the selected date.
Syntax:
{AGE( «format» , «date» )}
Arguments:

«format» (optional)
    "YMWD" (any combination of Years, Months, Weeks, Days)
    Note: Enclose the format parameter in double quotes. If you enter only the format without a date, do not include the comma after it. 
«date» (optional)
    Date to calculate against the date of birth (for example, encounter date, current date). The date can be any end date greater than the patient's date of birth.
    Format: YYYYMMDD
    Note: If the date is a hard-coded string, enclose it in double quotes. 
    If no format or date is specified, the default format is: YMD and today’s date.
Returns:The age in the format specified
Example 1:

Format parameter only
Current date=04/13/2012
person.date_of_birth = 04/01/1980
{AGE( "YWD" )}

Result: 31 Years, 1 Week, 5 Days

Example 2:

Format and date parameters
person.date_of_birth = 02/13/1975
{AGE( "YM" , 20120413 )}

Result: 37 Years, 2 Months

Example 3:

No parameters
Current date=04/13/2012
person.date_of_birth = 01/01/1960
{AGE( )}

Result: 52 Years, 3 Months, 5 Days