Oct 3, 2003 #1 buzzt Programmer Joined Oct 17, 2002 Messages 171 Location CA I have a cloumn in my MySQL that is formatted as military time hh:mm:ss. How would I tell PHP to display simply hh:mm? I have tried variations of the date() and mktime() functions, but can't get it right.
I have a cloumn in my MySQL that is formatted as military time hh:mm:ss. How would I tell PHP to display simply hh:mm? I have tried variations of the date() and mktime() functions, but can't get it right.
Oct 3, 2003 #2 sleipnir214 Programmer Joined May 6, 2002 Messages 15,350 Location US I'd use explode() (http://php.he.net/manual/en/function.explode.php) to split the time string into an array at the colons then print the parts I need in the format I need. Or I might use preg_replace() (http://php.he.net/manual/en/function.preg-replace.php) to simply replace "colong digit digit <end of string>" with nothing. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!! Upvote 0 Downvote
I'd use explode() (http://php.he.net/manual/en/function.explode.php) to split the time string into an array at the colons then print the parts I need in the format I need. Or I might use preg_replace() (http://php.he.net/manual/en/function.preg-replace.php) to simply replace "colong digit digit <end of string>" with nothing. Want the best answers? Ask the best questions: http://www.catb.org/~esr/faqs/smart-questions.htmlTANSTAAFL!!