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
https://forums.phpfreaks.com/topic/160326-solved-add-minutes-or-hours-to-time/
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.

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.