Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0D99A1337BDF for ; Fri, 22 Apr 2011 13:54:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 48696-02 for ; Fri, 22 Apr 2011 16:54:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from polaris.pinpointresearch.com (cerberus.pinpointresearch.com [66.7.238.130]) by mail.postgresql.org (Postfix) with ESMTP id C04311337BD3 for ; Fri, 22 Apr 2011 13:54:19 -0300 (ADT) Received: from betelgeuse.pinpointresearch.com (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id DAD6AE00EC82; Fri, 22 Apr 2011 09:54:11 -0700 (PDT) Message-ID: <4DB1B2B3.40605@pinpointresearch.com> Date: Fri, 22 Apr 2011 09:54:11 -0700 From: Steve Crawford User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: Marc Fromm CC: "pgsql-admin@postgresql.org" Subject: Re: unix timestamp References: <93361C67E4EE844A80935863A4FF4B6C04E86CB9@Exch2010MB-2.univ.dir.wwu.edu> In-Reply-To: <93361C67E4EE844A80935863A4FF4B6C04E86CB9@Exch2010MB-2.univ.dir.wwu.edu> Content-Type: multipart/alternative; boundary="------------020204020408040400080403" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/209 X-Sequence-Number: 37390 This is a multi-part message in MIME format. --------------020204020408040400080403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020204020408040400080403 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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

--------------020204020408040400080403--