Welcome Guest, Not a member yet? Register   Sign In
How long ago[solved]
#1

[eluser]R_Nelson[/eluser]
I'm trying to write a how long ago helper

i have
Code:
$chunks = array(
            array(60 * 60 * 24 * 365 , 'year'),
            array(60 * 60 * 24 * 30 , 'month'),
            array(60 * 60 * 24 * 7, 'week'),
            array(60 * 60 * 24 , 'day'),
            array(60 * 60 , 'hour'),
            array(60 , 'minute'),
        );
how would i i put in seconds?
#2

[eluser]LuckyFella73[/eluser]
It depends what "type" of time you want to pass to your helper.
Years, months, days, hours, milliseconds? If all of them you need
to pass a second parameter to tell the helper what "type" you
have as a base to calculate the seconds.

EDIT: maybe this one can help you further:
http://ellislab.com/codeigniter/user-gui...elper.html
#3

[eluser]R_Nelson[/eluser]
all i want to do is ad seconds to that array i am just guessing at it but im thinking i just need to add 60 * to each one of those and add a 60 for seconds
#4

[eluser]R_Nelson[/eluser]
figured it out i had to read it better but theres 1 sec in 1 second so i had to put
Code:
$chunks = array(
            array(60 * 60 * 24 * 365 , 'year'),
            array(60 * 60 * 24 * 30 , 'month'),
            array(60 * 60 * 24 * 7, 'week'),
            array(60 * 60 * 24 , 'day'),
            array(60 * 60 , 'hour'),
            array(60 , 'minute'),
            array(1, 'second')
        );
Milliseconds would be.1 and so on




Theme © iAndrew 2016 - Forum software by © MyBB