fesan Posted February 26, 2009 Share Posted February 26, 2009 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 More sharing options...
micah1701 Posted February 26, 2009 Share Posted February 26, 2009 you could use strtotime $fiften_minutes = strtotime("+15 minutes", $given_time); Link to comment https://forums.phpfreaks.com/topic/147020-mktime-and-add-time/#findComment-771840 Share on other sites More sharing options...
fesan Posted February 26, 2009 Author Share Posted February 26, 2009 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 More sharing options...
micah1701 Posted February 26, 2009 Share Posted February 26, 2009 900 is the number of seconds. <? $test = strtotime("+15 minutes", $time_day_start_count); echo date("H:i",$test); // should return 00:15 ?> Link to comment https://forums.phpfreaks.com/topic/147020-mktime-and-add-time/#findComment-771861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.