Jump to content

mktime and add time


fesan

Recommended Posts

Hello!

 

I'm making a time booking page. So the users can book time in a rom.

I want to make a page that the users can view the day and who has booked what time.

 

The booking is now based on a 15min interval. So i want to put out a line for every 15min in an hour.

 

But i cant figure out how to add 15min to the mktime:

 

$time_day_start = date(H:I, (mktime($time_day_start_hour, $time_day_start_min, 00, 0, 0 ,0));
$time_day_start_count = date(H:I, (mktime(0, 0, 00, 0, 0 ,0));

while($time_day_start_count <= date(H:I, (mktime(23, 45, 00, 0, 0 ,0))){
	echo "<tr>";
	echo "<td>";
	echo $time_day_start_count;
	echo "</td><td>Her kommer det mange som har booket rom</td></tr>";
	$time_day_start_count = // HERE I WANT TO ADD A VALUE TO THE TIME SO MY TIME EVENTUALLY REACHES 23:45.
}

Link to comment
https://forums.phpfreaks.com/topic/147020-mktime-and-add-time/
Share on other sites

Ehmmm....

 

Got some wierd result out of that so i tried it out like this:

 

$time_day_start_count = date("H:i", mktime(0, 0, 00, 0, 0 ,0));
echo $time_day_start_count. "<br>";
$test = strtotime("+15 minutes", $time_day_start_count);
echo $test;

 

this gives the result:

 

00:00

900

 

And the result im looking for is:

00:00

00:15

 

Link to comment
https://forums.phpfreaks.com/topic/147020-mktime-and-add-time/#findComment-771847
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.