Calculate age from 3 terms
-
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?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Calculate age from 3 terms’ is closed to new replies.