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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.