unistake Posted January 24, 2010 Share Posted January 24, 2010 Hi all, I have some times stored in mysql as a TIME. All of the times are in hours and minutes and do not incude seconds. When I retrieve the times from the database they are displayed like 03:22:00 - instead I just want them to be 03:22. Is there a simple script that does this idea. if mysql data = time change to hours and minutes. I have 4 bits of data that need changing once retrieved. Thanks for they help guys. Link to comment https://forums.phpfreaks.com/topic/189647-displaying-mysql-times-in-php-as-just-hours-and-minutes/ Share on other sites More sharing options...
Mchl Posted January 24, 2010 Share Posted January 24, 2010 1. $hhmm = date('h:i',strtotime($mysqlTime)); 2. $hhmm = substr($mysqlTime,0,5); 3. Use MySQL's TIME_FORMAT()[/code] Link to comment https://forums.phpfreaks.com/topic/189647-displaying-mysql-times-in-php-as-just-hours-and-minutes/#findComment-1000904 Share on other sites More sharing options...
unistake Posted January 24, 2010 Author Share Posted January 24, 2010 Works PERFECT, thanks! Link to comment https://forums.phpfreaks.com/topic/189647-displaying-mysql-times-in-php-as-just-hours-and-minutes/#findComment-1000912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.