Reputation: 386
I'm trying to calcute the time between now and a given time. But when I use timespan I get this error:
Fatal error: Call to undefined function timespan() in /Applications/MAMP/htdocs/VERSIE0.1/application/views/welcome_message.php on line 54 A PHP Error was encountered Severity: ErrorMessage: Call to undefined function timespan()Filename: views/welcome_message.phpLine Number: 54Backtrace:
<span class="time"><?php
$post_date = $t['story_date'];
$now = date('Y-m-d H:i:s');
echo timespan($post_date, $now);
?>
</span>
Upvotes: 0
Views: 744
Reputation: 53
Right answer is to include the helper on your view file. Just load the helper
$this->load->helper('date');
in your view, not in controller.
Upvotes: 0
Reputation: 499
Try this
or You can use this
Upvotes: 4
Reputation: 10356
In order to use the timespan
function you need to load its library, the helper
.
Make sure you write:
$this->load->helper('date');
Upvotes: 3