how to get day month and year of any post from WP post object?WordPress

I am trying to get day month and year of a post from WP post object.

what I did is:

Read More
<?php
 $cpost=get_post($_GET['p_id']);
 echo $cpost->post_date;echo "<br>";
?>

Outputs:

2013-12-26 13:25:18

what I need is, day month and year as:

26 Dec 2013

Related posts

Leave a Reply

4 comments

  1. Try this:

    Always use strtotime function to get Date, Month, and Year etc.

    echo date("d M Y", strtotime($cpost->post_date));
    

    Use the options you want in date function && pass values in strtotime function.


    Thanks