You want to compare a Postgresql date or timestamp to a unix time (seconds since the epoch).
Use date_part() or extract() datepart-ref extract-ref.
If you are planning to do a lot of temporal manipulation, always use Postgresql's date/time types - they offer better features. On the other hand, most client languages provide unix-style timestamps - these two functions can bridge the gap for you.
select date_part('epoch',now()) as unixtime;
select extract('epoch' from now()) as unixtime;
|