Reputation: 386
I'm building a webapp with CodeIgniter and I want to show the latest posts. I calculate the time between the date of posting and the current date. The problem is that it shows like this: 1d 4h 2m or 9h 32m. So I actually want only to show the 1d or 9h in this case. How is this possible?
This is how I calculate the time:
span class="time"><?php
$this->load->helper('date');
$post_date = strtotime($t['story_date']);
$now = strtotime(date('Y-m-d H:i:s'));
echo timespan($post_date, $now);
?> </span>
Upvotes: 0
Views: 61