function age = judge_age ( index )

%*****************************************************************************80
%
%% judge_age() returns the age in years of a given judge.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 January 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer index: the index of the judge.  1 <= index <= 9.
%
%  Output:
%
%    integer age: the age in years.
%
  [ db, mb, yb ] = judge_birthday ( index );

  birth = datetime ( yb, mb, db, 0, 0, 0 );
  today = datetime ( 'now' );
%
%  Compute the difference as a "CalendarDuration" array.
%
  dt = between ( birth, today, 'Years' );
%
%  Extract the year data.
%  Discovering that this was necessary, and how to do it,
%  was a miserable experience.
%
  age = split ( dt, 'years' );

  return
end

