Re: epoch from date field

From: Laurette Cisneros <laurette(at)nextbus(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: epoch from date field
Date: 2002-07-05 16:18:21
Message-ID: Pine.LNX.4.44.0207050916300.4809-100000@visor.corp.nextbus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Actually, we use tzset() to set the timezone. We're not operating in GMT
at all, but it returns GMT.

This, however does work returning the epoch for the current timezone:

select extract(epoch from map_date::timestamp);

So, for some reason extract won't convert a date to timestamp when it's
passed in?

Thanks for the help,

L.
On Thu, 4 Jul 2002, Tom Lane wrote:

> Laurette Cisneros <laurette(at)nextbus(dot)com> writes:
> > select extract(epoch from date(map_date)) from datemaps;
> > For a date: 2002-07-04
> > it returns 1025740800
> > which apparently translates to today (7/3) at 5pm. Is this right?
> > Shouldn't it return the epoch for midnight on 7/4?
>
> You're in GMT-7 to judge by your Date: header. That *is* midnight,
> GMT.
>
> regards, tom lane
>

--
Laurette Cisneros
The Database Group
(510) 420-3137
NextBus Information Systems, Inc.
www.nextbus.com
----------------------------------
"Intelligence complicates. Wisdom simplifies."
-- Mason Cooley

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2002-07-05 16:37:12 Re: Should next release by 8.0 (Was: Re: [GENERAL] I am
Previous Message Alvaro Herrera 2002-07-05 16:14:38 Re: two primairy key in one table ?