getAgeInDays: Age in days between two dates

View source: R/time.R

getAgeInDaysR Documentation

Age in days between two dates

Description

The whole number of days between a birth date and a reference date, both written as yyyymmdd.

Usage

getAgeInDays(currDate, birthDate)

Arguments

currDate

Reference date(s), yyyymmdd.

birthDate

Birth date(s), yyyymmdd, recycled against currDate.

Details

The result is in days. Convert it to years (⁠/ 365.25⁠) only when you need the age on the scale a rate function expects. The age reported in the simulation output is also years on that scale (days / 365.25, rounded to two decimals). Event dates, in contrast, are never put on the year scale: they go through the exact calendar in getInDateFormat().

Value

Integer vector of days. Negative when currDate is before birthDate; this is not treated as an error here.

See Also

getInDays()

Examples

getAgeInDays(20200826, 19800605)

MicSim documentation built on Dec. 2, 2026, 1:09 a.m.