From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org, Thomas Lockhart <lockhart@fourpalms.org>
Subject: Re: Calculation Error on Epoch?
Date: Wed, 28 Aug 2002 00:14:38 -0400
Message-ID: <17502.1030508078@sss.pgh.pa.us> (raw)
In-Reply-To: <web-1626380@davinci.ethosmedia.com>
References: <web-1626380@davinci.ethosmedia.com>
"Josh Berkus" <josh@agliodbs.com> writes:
> I'm having a problem with:
> SELECT date_part('epoch','2002-08-28'::TIMESTAMP)
> Which is consistently returning an epoch timestamp that evaluates to
> 8.27.2002. Is this a known issue? A cross-platform problem?
In 7.2 I get:
regression=# SELECT date_part('epoch','2002-08-28'::TIMESTAMP);
date_part
------------
1030507200
(1 row)
which seems to be correct given my timezone:
$ prdate 1030507200
time 1030507200 = Wed Aug 28 2002, 00:00:00 EDT
(prdate is a homegrown utility that just does strftime(localtime(...)))
It does seem to be broken in CVS tip, as I've complained to Thomas
at least once:
regression=# SELECT date_part('epoch','2002-08-28'::TIMESTAMP);
date_part
-----------
1030.4928 -- wrong
(1 row)
regression=# SELECT date_part('epoch','2002-08-28'::TIMESTAMPTZ);
date_part
------------
1030507200 -- right
(1 row)
What context are you testing in, and what do you get exactly?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, lockhart@fourpalms.org
Subject: Re: Calculation Error on Epoch?
In-Reply-To: <17502.1030508078@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox