The mysql timestamp is in a standard format 2013-02-20 02:25:21, when I use date(‘H:i:s’,$date) I get the same invalid output 18:33:33, how can I get the right output? hour:minute:seconds
Advertisement
Answer
Tip : try with MYSQL DATE_FORMAT
function
SELECT DATE_FORMAT('2013-02-20 02:25:21', '%H:%i:%s');
if you want to do it only with PHP then use strtotime
date('H:i:s',strtotime('2013-02-20 02:25:21'));