I am working on my new theme and for any post I would like to include the number of days ago that post has been posted, like at garrettdimon.com. I did something similar on my site but it does give me some strange numbers. The code I am using is
$date1 = strtotime(date('d-m-y'));
$date2 = strtotime(the_date('d-m-y', '', '', false));
$total_days = round(($date1-$date2)/(24*3600));
echo $total_days." days old";
- The topic ‘How many days ago a post is posted’ is closed to new replies.