Re: Timestamp to time_t

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Timestamp to time_t
Date: 2009-09-15 16:34:03
Message-ID: 025E5ACB-621D-440E-86BD-B936C75923E2@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sep 15, 2009, at 8:50 AM, Tom Lane wrote:

> See TIMEZONE_HOUR, TIMEZONE_MINUTE field specifications, in particular
>
> b) Otherwise, let TZ be the interval value of the implicit
> or explicit time zone associated with the <datetime value
> expression>. If <extract field> is TIMEZONE_HOUR, then
> the
> result is calculated as
>
> EXTRACT (HOUR FROM TZ)
>
> Otherwise, the result is calculated as
>
> EXTRACT (MINUTE FROM TZ)
>
> I haven't tracked down whether the phrase "implicit or explicit time
> zone" is hiding any interesting weasel words, but it sure *looks* like
> you are supposed to be able to pull out the TZ offset

try=# select extract(timezone_hour from '2001-02-16 20:38:40 America/
Los_Angeles'::timestamptz);
date_part
-----------
0
(1 row)

That doesn't look right. AFAICT, timestamptz converts the TZ to the
default TZ and discards the specified TZ. Same with offsets:

try=# select extract(timezone_hour from '2001-02-16 20:38:40
-08:00'::timestamptz); date_part
-----------
0
(1 row)

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-15 16:37:40 Re: WIP: generalized index constraints
Previous Message Jeff Davis 2009-09-15 16:28:21 Re: WIP: generalized index constraints