pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@gmail.com>
To: Janiv Ratson <yanivra@essence-grp.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: bigint and unix time
Date: Tue, 16 Aug 2011 06:43:54 -0700
Message-ID: <201108160643.54672.adrian.klaver@gmail.com> (raw)
In-Reply-To: <25B9D8D6D61CDB4CAD5D742B947F5C1A0493CBC8@ES-EX2010A-IL.essencesecurity.com>
References: <9C103394ED80654B9DD6D9347E9D3001040F2014@es-ex1-il.essencesecurity.com>
	<201108150714.08500.adrian.klaver@gmail.com>
	<25B9D8D6D61CDB4CAD5D742B947F5C1A0493CBC8@ES-EX2010A-IL.essencesecurity.com>

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



view thread (8+ messages)

Message-ID: <201108160643.54672.adrian.klaver@gmail.com>
Permalink:  ../201108160643.54672.adrian.klaver@gmail.com/
Also on:    postgresql.org/message-id/201108160643.54672.adrian.klaver@gmail.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-sql@postgresql.org
  Cc: adrian.klaver@gmail.com, yanivra@essence-grp.com
  Subject: Re: bigint and unix time
  In-Reply-To: <201108160643.54672.adrian.klaver@gmail.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