Re: Thoroughly confused about time zones

From: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "Tim Kelly" <Tim(dot)Kelly(at)rad-con(dot)com>
Subject: Re: Thoroughly confused about time zones
Date: 2011-02-28 15:18:35
Message-ID: 04A6DB42D2BA534FAC77B90562A6A03D01769651@server.rad-con.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think maybe I'm making things much more difficult than they need to
be. I tried this:

select cast (extract(epoch from ('2010-3-14 12:00'::timestamp -
'2010-3-13 12:00'::timestamp)) as integer) / 60 / 60

and got 24. The difference between timestamps without time zones is 24
hours, even though the interval spanned a time change.

But when I tried this:

select cast (extract(epoch from ('2010-3-14 12:00'::timestamptz -
'2010-3-13 12:00'::timestamptz)) as integer) / 60 / 60

I got 23, showing that even if I did not specify what time zone I'm
talking about, I got the correct answer.

RobR

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2011-02-28 15:18:36 Re: Thoroughly confused about time zones
Previous Message Rob Richardson 2011-02-28 15:06:28 Thoroughly confused about time zones