0

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

what i did is:

       <?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
1

Try it like this:

echo get_the_time('j M Y', $_GET['p_id']);

References:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.