Skip to content

age_in_years

Syntax

age_in_years()

Description

Returns the age of the calling agent in years, including fractional parts of the year.

This action returns an approximation of the number of years since the agent's assigned date of birth, using the formula age_in_days() / 365.25.

The result is a real number; that is, if age_in_days() is 1500 then age_in_years() evaluates to 4.106776. To get the number of whole years, use the age() action instead.

This calcuation of age_in_days() is exact for agents born during the simulation period. For agents with dates of birth prior to the simulation start_date, the calculation of age_in_days() assumes 365.25 days per year; that is, it may not be accurate due to leap days.

Examples

Suppose an agent is 1500 days old and makes the following action call:

my_age_in_years = age_in_years()

In this case, my_age_in_years would be assigned the value 4.106776.

See Also