Fai prima a farlo direttamente in sql:

SELECT UNIX_TIMESTAMP(CAMPO_DATA)-UNIX_TIMESTAMP() AS DIFF