pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Crawford <scrawford@pinpointresearch.com>
To: Marc Fromm <Marc.Fromm@wwu.edu>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: unix timestamp
Date: Fri, 22 Apr 2011 09:54:11 -0700
Message-ID: <4DB1B2B3.40605@pinpointresearch.com> (raw)
In-Reply-To: <93361C67E4EE844A80935863A4FF4B6C04E86CB9@Exch2010MB-2.univ.dir.wwu.edu>
References: <93361C67E4EE844A80935863A4FF4B6C04E86CB9@Exch2010MB-2.univ.dir.wwu.edu>

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

view thread (3+ messages)

Message-ID: <4DB1B2B3.40605@pinpointresearch.com>
Permalink:  ../4DB1B2B3.40605@pinpointresearch.com/
Also on:    postgresql.org/message-id/4DB1B2B3.40605@pinpointresearch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scrawford@pinpointresearch.com, Marc.Fromm@wwu.edu
  Subject: Re: unix timestamp
  In-Reply-To: <4DB1B2B3.40605@pinpointresearch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox