Jump to content

[SOLVED] Add minutes or hours to time


phpretard

Recommended Posts

I am trying to add minutes or hours to $current.

 

This time should expire after $var hours.

 

So I need this to compare now() to $expired

 


$current="2009-05-30 09:32:23";

$exired="2009-05-30 09:32:23" + $hours;



if ($expired >= now()){
  times up

}else{
  your still good
        }

 

any suggestion?

Link to comment
Share on other sites

This did it.

 

I insert it in mysql as the expired time and compair against it.

 


connect();

$get_time_limit=mysql_query("select time1 from preferences");
$timelimit=mysql_fetch_assoc($get_time_limit);

$exp=time() + (1 * $timelimit['time1'] * 60 * 60);
$expired=date('Y-m-d H:i:s', $exp);

mysql_free_result($get_time_limit);

 

Thank you for looking at it.

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.