posts - how to get day month and year from wp_post_object?

admin2025-06-03  19

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

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
Share Improve this question asked Jan 2, 2014 at 8:49 KamleshKamlesh 31 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Try it like this:

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

References:

  • get_the_time
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748907547a314713.html

最新回复(0)