Skip to content

age

age(birthdate, referenceDate?) → number · Date & Time

Calculate age in whole years from a birthdate. Uses today if no reference date provided.

  • birthdate (required): date of birth

  • referenceDate (optional): date to calculate age at (defaults to today)

bash
echo '{"dob": "1990-03-15"}' | utlx -e 'age(parseDate($input.dob, "yyyy-MM-dd"))'
# 36
utlx
{
  age: age(parseDate($input.dateOfBirth, "yyyy-MM-dd")),
  isMinor: age(parseDate($input.dateOfBirth, "yyyy-MM-dd")) < 18
}

Released under AGPL-3.0.