Re: funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone
Date: 2010-09-03 19:40:37
Message-ID: 28345.1283542837@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Josh Kupershmidt <schmiddy(at)gmail(dot)com> writes:
> EXTRACT(epoch ...) was what I was looking for:

> SELECT EXTRACT(epoch FROM ts - '1999-12-31 19:00:00-05'::timestamptz)
> FROM timestamps_test LIMIT 5;
> date_part
> -----------------------
> 1.4120666068199e-309
> 1.4154982781624e-309
> 1.41550281692099e-309
> 1.41591466059161e-309
> 1.41591524669472e-309
> (5 rows)

Wow. You must have gotten those with the help of some arithmetic,
because timestamptzin would never have produced them. I found out I can
do

regression=# select extract(epoch from ('2000-01-01 00:00:00'::timestamptz + '0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'::interval) - '2000-01-01 00:00:00');
date_part
-----------
1e-209
(1 row)

but I wonder what it was you actually did.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Kupershmidt 2010-09-03 19:52:45 Re: funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone
Previous Message Tom Lane 2010-09-03 19:36:43 Re: funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone