# Finding available time

**URL:** https://forum.kirupa.com/t/finding-available-time/301338
**Category:** programming
**Created:** [December 7, 2009, 10:46pm UTC](https://forum.kirupa.com/t/finding-available-time/301338 "2009-12-07T22:46:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)
#### Post date: [December 7, 2009, 10:46pm UTC](https://forum.kirupa.com/t/finding-available-time/301338/1 "2009-12-07T22:46:02Z")

</div>

Ok, I can already input available time in MySQL. Like:  
AvailableDay = Monday  
FromTime = 08:00  
ToTime = 11:00

Means it’s available on Mondays from 8-11am

Now, I need to create a drop down menu that will allow the user to select, schedule appointment:

8:00 2 hour  
8:00 1 hour and a half  
8:00 1 hour  
8:00 half hour  
8:30 2 hour  
8:30 1 hour and a half  
8:30 1 hour  
8:30 half hour  
9:00 2 hour  
9:00 1 hour and a half  
9:00 1 hour  
9:00 half hour  
9:30 1 hour and a half  
9:30 1 hour  
9:30 half hour

I’m trying to create loops but I don’t seem to come up with an simple solution.

This is what I have so far, I’m still figuring it out. Any suggestions will be appreciated.

```php
	public function getAvailableList(){
		$time=array();
		for($i=6; $i <= 22; $i++){
			$time[] = strtotime('+'.$i.' hour 12AM');
			$time[] = strtotime('+'.$i.' hour 15 minutes 12AM');
			$time[] = strtotime('+'.$i.' hour 30 minutes 12AM');
			$time[] = strtotime('+'.$i.' hour 45 minutes 12AM');
		}
		foreach($time as $value_time){
			
			echo date('H:i', $value_time).'<br />';
		}
		return $this->_availableList;
	}

```
