bigint and unix time

From: "Janiv Ratson" <janivra(at)essence-grp(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: bigint and unix time
Date: 2011-08-14 11:13:30
Message-ID: 9C103394ED80654B9DD6D9347E9D3001040F2014@es-ex1-il.essencesecurity.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have the following query:

select ticket as ticket, time as created, author as reporter,
cast(extract(epoch from (date 'now' - integer '30')) as bigint)

from ticket_change tc

where field = 'status'

and newvalue = 'reopened'

and time > extract(epoch from (date 'now' - integer '30'))

order by time

I'm trying it get all records that their 'time' is within the past 30
days.

However, the time is bigint: 1287323899000000

While the extract(epoch from (date 'now' - integer '30')) is 1310677200

As you understand, I always get all records ...

How do I solve it?

Thanks,

Janiv.

Best regards,

Janiv Ratson

Software Architect & Team Leader

Essence Home & Family LTD.. (Part of Essence Group)
Tel: +972-73-2447779 | Fax: +972-9-9564182 | Mobile: +972-507768822

Email: janivra(at)essence-grp(dot)com <mailto:janivra(at)essence-grp(dot)com> |
Site: www.essence-grp.com

This E-mail and any attachments transmitted with it (if any) ("E-mail")
is private and confidential, contains proprietary information belonging
to the Essence Group and is intended only for the intended recipient at
the email address to which it has been addressed. Any review,
retransmission, dissemination, copying or other use of, or taking of any
action in reliance upon this E-mail, by persons or entities other than
the intended recipient is prohibited. Please notify the sender
immediately by e-mail if you have received this E-mail by mistake and
delete this E-mail from your system. Any opinions expressed in this
E-mail are those of the sender and do not necessarily represent those of
Essence Group unless otherwise stated expressly and the sender is
authorised to do so. E-mail transmission cannot be guaranteed to be
secured or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or contain viruses. Essence
Group therefore does not accept liability for any errors or omissions in
the contents of this E-mail arise as a result of e-mail transmission or
for any damage caused by any virus transmitted by this E-mail.
P save a tree...please don't print this e-mail unless you really need
to.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David Harel 2011-08-14 17:15:43 Re: pgadmin debugger
Previous Message Adrian Klaver 2011-08-13 19:56:49 Re: pgadmin debugger