Time stamps
My project involves php and mysql. One element of the project is looking at the time in takes for an event to occur. At the moment, I’m using timestamps to record the time. I need to subtract the timestamps to produce the time difference.
This is the solution taht is working for me so far,
SELECT UNIX_TIMESTAMP(result_time)-UNIX_TIMESTAMP(request_time)
FROM tables
WHERE condition
This produces the time in seconds which I can later format to look nice.
P.S. I have altered the select statement so it produces the average like so:
AVG(UNIX_TIMESTAMP( result_time ) – UNIX_TIMESTAMP( request_time ))