takn25 Posted April 13, 2011 Share Posted April 13, 2011 Hi, I have a row in table called htime which is filled with mktime(). The thing I am trying to figure out is I want to echo something to the user if the time is less than 15 minutes from the current time and greater than htime (Row) for instance. htime(Row) (15 minutes in between) time() and when it goes over the the 15 minute mark to stop echoing. I have not been successful in comparing these please any help is deeply appreciated thanks! Quote Link to comment https://forums.phpfreaks.com/topic/233581-time-in-between/ Share on other sites More sharing options...
codebyren Posted April 13, 2011 Share Posted April 13, 2011 I'm not 100% sure that I understand your question but I'll give it a shot... <?php $htime = $row['htime']; # Some timestamp stored in a database $now = time(); # Current timestamp $cutoff = $now - (15*60); # The timestamp for 15 minutes ago // Check that $htime is in the past, but also not more than 15 minutes ago. if ($htime < $now && $htime > $cutoff) { echo "htime was less than 15 minutes ago..."; } ?> Hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/233581-time-in-between/#findComment-1201027 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.