Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

S2 Membership Time Left Days Remaining

function remaindate_shortcode($atts) {
    $atts = shortcode_atts(
        array(
            'post' => 'posts',               //Default Value
            'category' => 'uncategorized',   //Default Value
            'show' => '5',                   //Default Value
        ),
        $atts
    );
   ob_start();
	if ( is_user_logged_in() &&  current_user_can( 'subscriber' )) {
  ?>
        <div class="t-preriod-shortcode">
           <h4>Days Left :
			<?php 
	$startdate = date("Y-m-d", s2member_registration_time());
	$earliers =  date("Y-m-d", strtotime("14days", strtotime($startdate)));
	$earlier = new DateTime($earliers);
	$today = date("Y-m-d",time());
	$later = new DateTime($today);
	echo $diff = $later->diff($earlier)->format("%a");
			   ?>
			</h4>
        </div>
    <?php 
	}
  $myvariable = ob_get_clean();
        return $myvariable;
}
add_shortcode( 'trial-days-left', 'remaindate_shortcode' );