how to Count time from datetime using mysql

SELECT *,
SEC_TO_TIME(((TO_DAYS(ws.checkout) - TO_DAYS(ws.checkin))* 24*60*60) +
TIME_TO_SEC(ws.checkout) - TIME_TO_SEC(ws.checkin)) AS otime
FROM `work_sessions` as ws group by DATE(ws.checkin) 



Comments