Q:

PHP generated elements ignoring divs - Wordpress

Every time I try to use get_date function it ignores all divs and is being placed right after end of header - in the beginning of <div class="entry-content"> 
<div class="entry-content">
            May 16, 2014
    <div class="blogleft">
        <div class="mblog">

While the other functions are being correctly placed inside <div class="mblog">.
<div class="post-info">Posted on </div>

post-info is correctly nested under all the divs, however the date generated using the_date() goes all the way back.
    

function getblogpostsmain($atts, $content = null) {
   extract(shortcode_atts(array(
      'posts' => 1,
   ), $atts));

   $return_string .= '<div class="mblog">';
   query_posts (array('orderby' => 'date', 'order' => 'DESC' , 'showposts' => $posts));
   if (have_posts()) :
      while (have_posts()) : the_post();
    $return_string .= '<h1 class="blog-title"><a href="'.get_permalink().'">'.get_the_title().' </a></h1>';
    $return_string .= '<div class="post-info">Posted on '.the_date().'</div>';
    $return_string .= '<p class="post-excerpt">' . get_the_excerpt() . '</p>';
endwhile;
   endif;
   $return_string .= '</div>';

   wp_reset_query();
   return $return_string;
}

?>

Any idea what the hell is going on? I am going out of my mind. 
Theme used: Vantage theme

A:

You're using the_date() which will output the date when what you need is a function to return the date.
Swap the_date() with get_the_date().
E.g:
$return_string .= '<div class="post-info">Posted on ' . get_the_date() . '</div>';

Further reading: http://codex.wordpress.org/Template_Tags/get_the_date

