Search code examples
phpwordpressbbpress

bbpress forum date Thu Jan 1970


I have a Code in my forum.php

<?php global $post;
$lalaposttime = date( 'D M Y', strtotime( $post->post_id ) );
echo $lalaposttime; ?>

But I get “THU JAN 1970” now. (I’d prefer the exact date)


Solution

  • You will never get a correct Date I guess, strtotime needs a valid date string, but you are providing an ID $post->post_id shouldn't be a $post->post_date or a valide string date !

    Edit

    After seeying your dump : Channge $post->post_id to $post->post_date_gmt