The mysql timestamp is in the standard format 2013-02-20 02:25:21, when I use the date ('H: i: s', $ date), I get the same invalid output 18:33:33 as I can get the right result? hours: minutes: seconds
Tip: try with the MYSQL function DATE_FORMAT
DATE_FORMAT
SELECT DATE_FORMAT('2013-02-20 02:25:21', '%H:%i:%s');
if you want to do this only with php use strtotime
strtotime
date('H:i:s',strtotime('2013-02-20 02:25:21'));
use this date('Y-m-d H:i:s',strtotime($date));
date('Y-m-d H:i:s',strtotime($date));
It can help you.
date('H:i:s',strtotime($date));
Try date('Y-m-d H:i:s',strtotime($date));
Try strptime()
strptime()
strptime($date,"%H:%M:%S")