I've struggling to find a solution to this.
I have three taxonomies: 'dob', 'mob', 'yob' and I'm trying to calculate the age in years using all 3.
The code I've been messing with:
function age_in_years() {
global $post;
$year_of_birth = get_post_meta( get_the_ID( $post->ID ), 'yob', true );
$date1 = strval( $year_of_birth );
$date2 = strval( date( 'Y') );
$age = $date2 - $date1;
return $age;
}
Could anyone lend a hand?