So my query is like this:
SELECT TIMEDIFF(\'24:00:00\',(TIMEDIFF(\'22:00:00\',TIME(end)))) AS time FROM sworkingtime WHERE user=\'magdalena\' AND type=\'work\' A
You can iterate the array and use this function to sum Sum time php