SQL Get all records older than 30 days

Try something like:

SELECT * from profiles WHERE to_timestamp(last_login) < NOW() - INTERVAL '30 days' 

Quote from the manual:

A single-argument to_timestamp function is also available; it accepts a double precision argument and converts from Unix epoch (seconds since 1970-01-01 00:00:00+00) to timestamp with time zone. (Integer Unix epochs are implicitly cast to double precision.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)