Why does the_date work in the first custom column, but not in the second, in a series of customized Posts columns?

Interesting challenge. I was given a piece of code earlier, which I have modified as follows for the Posts page.

/* add time stamp */
add_filter('manage_posts_columns', 'posts_columns', 5);
function posts_columns($defaults){
    $defaults['your_date_col'] = __('Date');
    $defaults['week_number'] = __('Wk#');
    $defaults['week_in_quarter'] = __('Wk/Qtr');
    return $defaults;
}
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
function posts_custom_columns($column_name, $id){
    if($column_name === 'your_date_col'){
    echo the_date('d M'),' ',the_time('Ha');
    }
    if($column_name === 'week_number'){
    echo 'Here: ',the_date();
    }
}

Strangely, although the date format that I have given shows up in the first column (“your_date_col”), only “Here: ” shows up in the second column (“week_number”). Any suggestions as to why the_date function doesn’t work in the second column?

Solutions Collecting From Web of "Why does the_date work in the first custom column, but not in the second, in a series of customized Posts columns?"

1) the_date() echoes the date value, so this statement isn’t correct:

echo the_date('d M');

It should be:

the_date('d M');

2) If you have some posts posted on the same date, the_date() will show only the date value for the 1st post. There will be no result for remained posts.

To get date of all post, use get_the_date() (which returns date value) or the_time() instead.

There is a explanation at top in the_date function reference. I try to use always the_time() instead.