Jump to content

Convert 11 AM to string of time


Recommended Posts

I have a form that submits G


How can I convert this to string of time when I need to insert it into the database and then turn it back around when it needs to be read?


<option>11:00 AM</option>
<option>11:30 AM</option>
<option>12:00 PM</option>
<option>12:30 PM</option>
<option>1:00 PM</option>
<option>1:30 PM</option>


Thank you.

Link to comment
Share on other sites

function halfhourclock($i){
	return floor($i*0.5).':'.$halfhour.'0 AM';
	return floor(($i-24)*0.5).':'.$halfhour.'0 PM';
echo halfhourclock($i).'<br />';

You can save the time in mysql as a tinyint this way.

Probably far better ways of doing it, just thought this would be simple...

Link to comment
Share on other sites


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.