Jump to content

How to loop between one hour??


Jenling

Recommended Posts

Hello, Im building a booking system recently. The booking system is able to view the book the room and user is able to see if the room is available during the time. I know that the loop in half and hour range is something like this:

 

for($i=$start; $i<$stop; $i=$i+50) {

  $contents .= "    <tr>\n";

 

 

    $first_num = substr($i, 0, -2);

  if(substr($i, -2) == 50) $last_num = '30'; else $last_num = '00';

  if($last_num == 30) { $sec_last_num = '00'; $sec_first_num = $first_num+1; } else { $sec_last_num = '30'; $sec_first_num = $first_num; }

$contents .= "      <td class=\"timecell\">".$first_num.":".$last_num."-".$sec_first_num.":".$sec_last_num."</td>\n";

 

  for($g=0; $g<7; $g++) {

    $seek_time = $g*24*60*60+$last_monday+($first_num*60*60+$last_num*60);

    $s_result = search_between($seek_time, $result); 

   

    if(!$s_result) {      $MRname = " ";

      $not_found = false;

    } else {      $not_found = true;

 

      $MRname = stripslashes($s_result['MRname']);

     

            if($cycle[$g] == 0 && (($s_result['endTime'] - $s_result['startTime'])/60/30) >= 1) {

                $cycle[$g] = ($s_result['endTime'] - $s_result['startTime'])/60/30;

        $begin = 1; // Kerrotaan, että täytyy aloittaa solu

      }

    }

 

However, i dont know how to loop it if I want the range to be in one hour range, for example, 0800-0900 and so on till 1700-1800.

Can anyone help me with this? ???

   

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.