$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
- “acf/load_field” Critical error upon saving/updating WooCommerce products [closed]
- Put ACF function output code the_terms
- Cannot Access ACF Field Values via my Plugin
- How to create advanced custom fields for backend content
- How to capture number input from wordpress form into acf field in woocommerce
- add class to woocommerce single product template gallery thumbnails if media attachment ACF field toggled (true/false)
- Exclude function for custom pages, exclude custom ACF fields
- Display posts in correct month order using single date custom field
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Fallback image URL if no featured image exists via a shortcode function
- Unable to render custom field after attempt to generate a list of recent post in page template
- How to style injected code in header section?
- Is there a hack for using is_page() within the function.php file?
- Query for user roles
- Add a custom class to the body tag using custom fields
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Define category ID using get_post_meta
- how to enqueque code in a php file from functions.php
- Class property seems to lose scope, attached to save_post action?
- Randomize Color Scheme Selection in Theme
- Add a counter for mouseovers (custom field)
- Extract and display user infromation on an automatically created page
- Must filter functions receive all arguments passed to them?
- Custom Taxonomy Select Menu: Setting default option value?
- How to add author’s posts link (HTML + PHP) inside a function to output it
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- How to Display a List of Child Pages For a Parent Page in WordPress
- Only load certain artists on this page
- Nav-Menu not showing up
- Show different website layout if no sidebar added
- Creating customized php files in theme folder
- writing an unique php function to be used on my website
- Child Theme’s Read More Text
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Unable to Call More than One Meta Box Output
- Dynamically Generate Functions and Hooks
- Displaying Event within two given time frames
- How can I alter this code to accept a slug as well as an ID?