Re: [GENERAL] SELECT Date

From: Evan Howarth <ehowarth(at)intellicall(dot)com>
To: pgsql-general(at)postgresql(dot)org (PostgreSQL List)
Subject: Re: [GENERAL] SELECT Date
Date: 1998-10-08 19:24:00
Message-ID: AFCA1C3681746AD1@dal.intellicall.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>I have a table with somedate defined as date.
>
>I want to select all rows that are from todays date back to 7 days
>ago. Or in this case 10-1-1998.

Use the function age() somewhat like this:

select * from sometable
where date_part( 'epoch' , age( 'now', somedate ) ) > 604800

The 'epoch' date part is the total number of seconds between the two dates.
For other variations, see:

http://www/postgresql.org/docs/user/functions1574.htm

Browse pgsql-general by date

  From Date Subject
Next Message Taral 1998-10-08 19:48:08 select * from table where oid = number;
Previous Message Anand Surelia 1998-10-08 19:07:59 Re: [GENERAL] Row Nums