billhobbs Posted May 29, 2012 Share Posted May 29, 2012 I have a time field that I want to display like so. The field shows 09:00:00 I want it to show 9:00am What is the php script? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/263336-display-mysql-time-field/ Share on other sites More sharing options...
scootstah Posted May 29, 2012 Share Posted May 29, 2012 Refer to this: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format Quote Link to comment https://forums.phpfreaks.com/topic/263336-display-mysql-time-field/#findComment-1349570 Share on other sites More sharing options...
billhobbs Posted May 29, 2012 Author Share Posted May 29, 2012 That just boggled my mind. It looked like most of this was for date, timestamp, datetime fields my field is just the time. What I've been doing to display the others doesn't work with just a time field. If my query gives me a $sessionvalue result of 09:00:00 from the time field. How do I convert the 09:00:00 to to display as 9:00am? Quote Link to comment https://forums.phpfreaks.com/topic/263336-display-mysql-time-field/#findComment-1349576 Share on other sites More sharing options...
billhobbs Posted May 29, 2012 Author Share Posted May 29, 2012 Never mind I figured it out.... echo date('g:i a', strtotime($row_Event['time'])); Thanks for pointing me in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/263336-display-mysql-time-field/#findComment-1349585 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.