Just gave an example of how to do it:
$today_date = new DateTime( date( 'Y-m-d', strtotime( 'today' ) ) );
$register_date = get_the_author_meta( 'user_registered', get_current_user_id() );
$registered = new DateTime( date( 'Y-m-d', strtotime( $register_date ) ) );
$interval_date = $today_date->diff( $registered );
if( $interval_date->days < 31 ) {
echo 'With us ' . $interval_date->format('%d days');
}
elseif( $interval_date->days < 365 ) {
echo 'With us ' . $interval_date->format('%m months %d days');
}
elseif( $interval_date->days > 365 ) {
echo 'With us ' . $interval_date->format('%y years %m month %d days');
}
Related Posts:
- Converting Unix timestamp to wordpress date
- Update existing post times to random times?
- Timezone for Plugin
- How to get Unix Local Time?
- How to second orderby in “pre_get_posts” by meta value or combine single date and time to timestamp
- Get system timestamp in wordpress
- Unable to select an old date in wordpress
- How to get date for each post?
- Date, Time, and Timezones
- Modify Date Format to German
- Serve visitor post time adjusted to their timezone
- Styling the date format with date_i18n
- Date and time format for UK in a custom post type [closed]
- What are the “U” and “G” time formats?
- date() returns incorrect value if used from WordPress theme, but correct otherwise
- How to get date using timezone saved in options? [duplicate]
- wordpress convert timestamp to date not correctly
- display month in french in wordpress/php?
- Set the publication date independent of the scheduled publication date
- About Time conditionals
- Format Date for Manual Insertion into post
- Translate current_time
- Display published time for today’s posts only
- convert time to WordPress user’s local time
- How to get User Time Zone in WordPress?
- Show different time stamp based on time
- Can’t convert ACF datepicker value to DateTime oject – gives me a boolean
- Can’t add to time? [closed]
- How to display Date and Time in Tamil Language?
- Get current week’s day and time outside the loop
- Use the_date with link
- automatic send email at custom time
- Change the date and time in wordpress
- Make datestamp for status updates show time
- Advanced Custom Fields and date picker, show posts only if the day is today no matter the year
- How to customize Date Format for American visitors?
- R Programming Error in cov.wt(z) : ‘x’ must contain finite values only
- Get date of last update outside of loop
- Keeping post_date same as the pending post_date on privately publishing the post
- Is it safe to use ‘date_default_timezone_set’ in plugin file?
- Date comparison : which date format?
- XML export posts from one single day
- Automatically move pending posts after 30 days and, update the post date, when users update the posts
- month name translation
- Count days from registration date to today
- Human Time Diff, change mins to minutes
- Display date only once for a each set of posts relating to that date
- Remove “at” string from wordpress comment date
- How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?
- Date query not inclusive despite parameter being true
- Finding difference in days
- Query by custom dates in UNIX Time
- get_queried_object error How to show post count by month in the taxonomy page
- Change date from 2015/02/23 to “1 min ago”
- Display post date as 04/26/2013
- Individually styling date month year [closed]
- timestamp and scheduled post irregularities
- Get date numerical and separate?
- Add a link to display posts with a specific tag within a date range
- How can I show many posts an author has per week?
- After wp_insert_post(), date_i18n() and date() outputs are adjusted to GMT
- Convert GMT time to local time in Gutenberg Block Editor
- Post count by month of taxonmy term
- Randomised Post Time
- Do multiple jobs on date change without WordPress cron job
- Separately formatting date elements
- How replace post date with event date
- Conditional: IF post creation date is in the first half OR last half of the year [closed]
- Change post date for testing purposes
- How to change the date and time in REST API for comments?
- Get Author Count By Day, Week and Month
- Sort / display recent posts by publish date
- How to show different timestamp
- admin end post published time display not working correctly
- Randomizing Post Links Outside of Loop – No Author or Date
- Media attachment date and post date
- date format of custom date variable
- changing type of date picker in contact form 7 date picker plugin
- If X Amount of Time Has Passed Since Post Was Published, Do Something
- How to set post date in post_type so that it’s same as latest post in category
- User set date and time from frontend doesn’t get stored into database
- Not work hide comments with future date
- Translate Post date (month) of china language
- How to display posts categori list by day wordpres
- get_the_date() returns english Year & Day when language is Arabic
- Compare ACF Date field to today or yesterday
- get_queried_object not work in taxonomy page
- Tumblr imported blog showing wrong date
- How do you update post date (year only) in a separate custom field?
- Include post_date in search
- Display Year and Month from custom field + Age Calculator
- Issue with strtotime() and Meta Box date
- Calculate how much time passed comparing WordPress comment and current time
- Show post date on the page
- Post publish date [duplicate]
- Date comparison : which date format?
- Saving Revision of post meta key/value on each update_post_meta event
- Limit access to a page
- Can someone explain why wordpress uses two column for storing time values?
- Display the last date, regardless of articles