Below code is useful to get how long the user is registered with your blog/website based on wordpress. The PHP code will give output time in days. You can convert that to month easily.
We need to convert timestamp stored by wordpress in MySQL as datetime format.
<?php
date_default_timezone_set('UTC'); //This must be same as your wordpress timezoneglobal $wpdb, $user_ID;
if(is_user_logged_in())
{
$userid=intval($user_ID);$result = mysql_query(“SELECT ID,user_registered FROM wp_users WHERE ID=’$userid’”);
while($row = mysql_fetch_array($result))
{$dd1=date(‘d M Y’,strtotime($row['user_registered']));
$days = floor((time() – strtotime($dd1))/86400);echo “User is registered since”.$days.” Days”;
}
?>
After getting days you can use it as a numerical value. Variable days will have final output.