Jump to content

Time Remaining


gerkintrigg

Recommended Posts

I'm trying to use this function:

http://www.go4expert.com/forums/showthread.php?t=456

 

It seems to work fine, but i'm wondering what kind of integer needs to go into it?

 

I'm trying this code and the number that's output seems to be far too long (time-wise).

include $root.'includes/functions/time_remaining.php';
$now=time();
$timeleft=time_left(strtotime($r['reg_date'])-strtotime($now));
echo $timeleft;

 

Could anyone help me please?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/76185-time-remaining/
Share on other sites

  • 2 weeks later...

That function takes seconds as an input.

 

I think the strtotime($now) where $now=time() might be the problem -- time() returns a timestamp as an integer, strtotime() takes a string representation of a time and automagically converts it into a timestamp. If you pass time() to strtotime() I'm not sure what it will do. Just use time() instead of strtotime(time()).

 

This page has some good documentation on what strtotime does

Link to comment
https://forums.phpfreaks.com/topic/76185-time-remaining/#findComment-395341
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.