$birthday_ts = strtotime( get_field('dob') );
$now = current_time( 'timestamp' );
$years = intval( ( $now - $birthday_ts ) / YEAR_IN_SECONDS );
$months = intval( ( $now - $birthday_ts ) / MONTH_IN_SECONDS );
$weeks = intval( ( $now - $birthday_ts ) / WEEK_IN_SECONDS );
$days = intval( ( $now - $birthday_ts ) / DAY_IN_SECONDS );
$hours = intval( ( $now - $birthday_ts ) / HOUR_IN_SECONDS );
$minutes = intval( ( $now - $birthday_ts ) / MINUTE_IN_SECONDS );
$seconds = intval( ( $now - $birthday_ts ) );
echo $years . ' years | ' . $months . ' months | ' . $weeks . ' weeks | ' . $days . ' days | ' . $hours . ' hours | ' . $minutes . ' minutes | ' . $seconds . ' seconds' ;
I just tried it with my own birth date, 16-08-1978 and got this result:
39 years | 481 months | 2061 weeks | 14433 days | 346394 hours | 20783654 minutes | 1247019262 seconds
Related Posts:
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Delete images from media library when user deletes an image from ACF Gallery
- ACF number less than comparison not working
- Display all values of custom a field created with ACF on a page
- How to automatically apply woocommerce product title to all product images alt tags?
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- If Custom Field is empty don’t display div
- Add custom field to attachments in a specific category
- The values of custom fields are not available functions.php
- How can update custom meta for all posts
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- Unique key for each row in a repeater field
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Importing hard coded custom field into acf field
- Passing the custom field values in the wp_get_current_user array function
- ACF: how do I get the fields and its values of a specific group?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Firing schema via code in functions.php doesn’t work
- How to use thumbnail size of image if I’m only using src to get image
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Which PHP page is the Default Posts Page
- Advanced Custom Fields – display label and value only if value entered
- Download PDF after CF7 form submission
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- Why does this update_post_meta function not delete the custom field itself?
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- How to show/hide php table rows based on the content of custom fields
- Custom meta box values are not getting saved for my custom post type
- HTML Special Characters in URL string [closed]
- Creating an image from a custom field
- How can I count ACF sub_field with a certain value
- WP All Import / Update stock quantity from multiple XML files
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- How to add data to a custom field at the wp_users table?
- Hide a div when a custom field is empty
- Including Custom fields within the_content
- Conditional On custom field plugin metabox
- Updating Metadata with Shortcode
- Products listing check if meta checkbox is checked
- Trying to update Woocommerce meta values
- Is it possible to update the dataset using update_post_meta
- Block error message in foreach loop when looping through ACF field
- Hide a div if the fiels is empty
- Query on a repeater date (acf)
- ACF – Can’t get custom post type by taxonomy
- Advance custom fields variable with if statement & Function
- How do I get the value of a current user’s custom field?
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Display custom meta box in my template file
- Appending an ACF custom field to the page title
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Creating posts with php-script + csv
- How to pass value to add_filter wpcf7_form_tag from another function?
- Custom Admin Menu Report for Specific User ID
- wp_set_object_terms and arrays
- How to use multiple query with same meta key
- How to use WordPress (PHP) functions in AngularJS partials files?
- Use ajax to update_post_meta
- enqueue multiple Google fonts with multiple weights and styles (italic)
- ACF check if variable has http, if else return string
- tracking number field in Woocommerce order [closed]
- WSoD being caused by this piece of code
- How to complete two other input fields, completed the first
- Remove the first 5 characters of the_title and orderby that
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Scrape external webpage for first image and add it to new post
- jQuery code not working when included in functions.php
- Fatal Errors on pluggable.php
- Log in / Log Out Custom Button
- Fatal error: Call to undefined function register_new_user()
- How to modify the default feed via a function
- Loop over Array and get the distinct ids
- How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?
- Display Custom Field in Sidebar if Value is Present
- Dynamic Menu drops pages?
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- Adding an Unlinked Space in a Custom Function
- Update user repeater meta (ACF) with another user meta field value
- send popup after wp_redirect()
- Checkbox doesn’t save inside metabox
- Add Featured Image to Existing Post
- How to get latest post ID in functions.php?
- Billing detail page doesn’t work after I’ve changed the order of the Woocommerce navigation
- How can I prevent a shortcode div from extending beyond its boundaries?
- Sum All the Post Meta of Published posts of Current Logged in user
- Ordering / grouping posts by datepicker ACF
- php if, else & custom fields – syntax error
- How to create “page” used for generating PDF? [closed]
- Why isn’t my custom function kicking in from my functions.php file?
- Shortcoding with Divs
- static array on functions.php
- Too many if’s and else if’s ?? – Must be better way [closed]
- Alternative to php echo within code