Jump to content

Checking the time


bschultz

Recommended Posts

I need to query a database for a starting time for a meeting, and if the start time is at 7pm, I need to allow access to a page from 6pm til 11pm.  Not a problem.

 

The problem lies when the ending time (4 hours after the start time) crosses over to a new day.

 

Here's what I have:

 

<?php
elseif ($row['meeting'] == "7:00pm") { $starthour = 18; $endhour = 23; }
elseif ($row['meeting'] == "8:00pm") { $starthour = 19; $endhour = 0; }

if ($thishour <= $endhour && $thishour >= $starthour)
{  include "meeting_ok.php"; }
else { echo "Meeting room is unavailable at this time...."; }
?>

 

 

The "0" for endhour is throwing things off.  How should I best account for a new day?

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/253460-checking-the-time/
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.