So i have a session table which in essence has the following cols:
session_id | user_agent | last_activity (in unix timestamp)
When i tried to display the session_id and last_activity from a session that is created 5 minutes ago using this query
SELECT session_id, from_unixtime('last_activity' / 1000, '%Y-%m-%d %H:%i') AS session_time
FROM gw_sessions
WHERE last_activity >= unix_timestamp(CURRENT_TIMESTAMP - INTERVAL 5 MINUTE) * 1000
It does not work.
So i tried to simplify my query by just displaying all the sessions (session_id and last_activity) using the following query
SELECT session_id, from_unixtime('last_activity' / 1000, '%Y-%m-%d %H:%i') AS session_time
FROM gw_sessions
The result shows like this
session_id | session_time
abcdefg... --> 1970-01-01 07:00 (epoch)
Why it did not convert the value correctly and how can i compare two dates (now()) with the date stored in unix format correctly?