I am using wordpress for only the blog portion on my site. I would like to display recent posts on my home page. I am able to show them fine, but the dates show up as "December 31, 1969". Wordpress sets the post_date
column as datetime
. Here is what I'm doing to pull it back in PHP:
$date = $row['post_date'];
$post_date = date("j/n/Y", strtotime($date));
This isn't doing it for me. Can someone help me out?
Thanks
How are you calling the posts? If you're using a WP loop then they're returned as objects, not arrays, so you would use:
$post_date = date('j/n/Y', strtrotime($post->post_date));