Re: unix timestamp

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: unix timestamp
Date: 2011-04-22 16:54:11
Message-ID: 4DB1B2B3.40605@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 04/21/2011 12:19 PM, Marc Fromm wrote:
>
> Is there a way to query a unix timestamp date? In the database the
> orderdate field is a unix timestamp.
>
> I would like to create the where clause to a query on a specific date
> like December 17, 2010.
>
> Select * from orders where orderdate = '12/17/2010';
>
> Thanks
>
> Marc
>

If by "unix timestamp" you mean epoch, just extract the epoch from your
date or timestamp:

steve=# select extract(epoch from date '12/17/2010');
date_part
------------
1292572800

Cheers,
Steve

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Craig James 2011-04-22 17:49:54 select for update
Previous Message Erwin Brandstetter 2011-04-22 16:26:43 DELETE FROM pg_description WHERE ...