Re: bigint and unix time - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: bigint and unix time
Date
Msg-id 201108160643.54672.adrian.klaver@gmail.com
Whole thread Raw
In response to bigint and unix time  ("Janiv Ratson" <janivra@essence-grp.com>)
List pgsql-sql
On Tuesday, August 16, 2011 2:12:52 am Janiv Ratson wrote:
> Hi Adrain and thank you,
> Trac 0.12 uses microseconds as time value.
> What do you suggest?

extract(epoch ..) returns seconds which you are trying to compare to 
microseconds. The solution would be to divide your 'time' values by 1,000,000 to 
make them seconds. Like:

SELECT ticket, "time"/1000000, author, field, oldvalue, newvalue FROM ticket_change where "time"/1000000  BETWEEN
extract(epoch from (date 'now' - integer '30')) AND       extract(epoch from (date 'now'));
 


> 
> Thanks,
> Janiv.
> 

-- 
Adrian Klaver
adrian.klaver@gmail.com


pgsql-sql by date:

Previous
From: Viktor Bojović
Date:
Subject: Re: which is better: using OR clauses or UNION?
Next
From: "David Johnston"
Date:
Subject: Re: which is better: using OR clauses or UNION?