I am trying to do a real-time bidding system in php and I am struggling with displaying the time format. I did the time Subtraction in the sql query and I am getting the time in this format -91100. So How can i display it in this format hh/mm/ss ?
here is my query
$sql = "select CURTIME()-time as newtime,id,name,end_date from product";
If you subtract to time expressions from each other, then you get the difference is seconds. To convert seconds back to time format, use sec_to_time() function:
select sec_to_time(CURTIME()-time) as newtime,id,name,end_date from product
TIME_FORMAT(TIMEDIFF(CURTIME(),time), '%H:%i:%s') as newtime
i chose a different approach to shadow and used TIMEDIFF(), added format to if you require that