Home:ALL Converter>Mysql time difference UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timestamp)

Mysql time difference UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timestamp)

Ask Time:2014-03-22T01:48:33         Author:NestedCodeblocksFTW

Json Formatter

My current sql statement is like follows..

SELECT * FROM `Main`
WHERE username = '$username'
AND fromsite = '$website'
ORDER BY `votes`.`timestamp` DESC
LIMIT 0 , 1

however the timestamp column shows a timestamp like " "2014-03-19 12:00:43" ...Following another question I had an answer along the lines of using ...

SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timestamp) AS seconds_ago

However not great with mysql and still don't see how I can still use the original select statement and work in a function like above, so that converts the timestamp column and shows as seconds ago instead.

Author:NestedCodeblocksFTW,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/22565967/mysql-time-difference-unix-timestamp-unix-timestamptimestamp
yy