How to get date of post when using wp_get_recent_posts()?

You can see everything returned via php’s var_dump or print_r:

$recent_posts = wp_get_recent_posts();
echo '<pre>';
print_r( $recent_posts );
echo '</pre>';

This will reveal that the date is stored in post_date:

foreach( $recent_posts as $recent ):
    echo $recent['post_date'];
endforeach;

Or to format the date, use php’s date and strtotime:

echo date( 'l F jS', strtotime( $recent['post_date'] ) );

tech