CodeIgniter Forums
Date helper > Timespan function - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Date helper > Timespan function (/showthread.php?tid=1569)



Date helper > Timespan function - Muzikant - 03-22-2015

I think I found a bug in the date helper's timespan function. If you will try the following code, it will output only years (1), months (2), weeks (3), days (4), hours (5), minutes (6), but no seconds (7).

PHP Code:
class Test extends CI_Controller {

    public function 
index()
    {
            
$this->load->helper('date');
            echo 
timespan(0time(), 7);
    }


The bug is in the system/helpers/date_helper.php file on line 258 I think. Please check it and propose a solution. But maybe everything is alright and I am just do not understand how it should work.