BentoUsers

Calculating Ages

A two-tier burgundy lacquer bento box tied with a strap
A two-tier bento box, the app’s namesake. Photo: goblinbox (CC BY 2.0).

A calculation field can show a person’s age from a birthday field. The formula used in Bento was:

(Today - Birthday) / (60 * 60 * 24 * 365.25) - 0.5

How it works

Subtracting the birthday from today gives a number of seconds. Dividing by the seconds in a year (60 × 60 × 24 × 365.25) turns it into years with decimals. Bento then rounds to the nearest whole number, so 27.99 would show as 28 even though that birthday is tomorrow. Subtracting 0.5 first makes the rounding behave like counting completed years.

The catch

In Bento 1.0v2, Today was not refreshed once a record existed, so ages stopped changing. Opening the field’s edit dialog and closing it forced a recalculation. Later versions handled this better, but it is worth checking any age you see in an old library.

The same thing today

If you have moved your data to a spreadsheet, Numbers and Excel both have DATEDIF: DATEDIF(birthday, TODAY(), "Y") returns completed years with no rounding trick. Database apps such as Tap Forms have date functions in their calculation fields that do the same.

The Bento years in pictures

Photos: goblinbox (CC BY 2.0), David Wellbeloved (CC BY 2.0), Uadro (CC BY-SA 4.0) and Martin Pettitt (CC BY 2.0), via Openverse and Wikimedia Commons.