In what situations is it considered appropriate to store only the age of a person in a database, as opposed to their full birth date?

It is considered appropriate to store only the age of a person in a database when the exact birth date is not necessary for the application's functionality and when privacy concerns may arise from storing the full birth date. By storing just the age, you can still perform age-related calculations and comparisons without exposing the individual's complete birth date.

// Storing only the age of a person in a database
$birthDate = "1990-05-15";
$age = date_diff(date_create($birthDate), date_create('today'))->y;

// Save $age in the database instead of $birthDate