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
1 Answer
Reset to default 1Try it like this:
echo get_the_time('j M Y', $_GET['p_id']);
References:
get_the_time