pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCalculation Error on Epoch?
3+ messages / 3 participants
[nested] [flat]
* Calculation Error on Epoch?
@ 2002-08-28 03:30 Josh Berkus <josh@agliodbs.com>
0 siblings, 2 replies; 3+ messages in thread
From: Josh Berkus @ 2002-08-28 03:30 UTC (permalink / raw)
To: pgsql-sql
Folks,
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?
Suggestions?
-Josh Berkus
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Calculation Error on Epoch?
@ 2002-08-28 03:54 Christopher Kings-Lynne <chriskl@familyhealth.com.au>
parent: Josh Berkus <josh@agliodbs.com>
1 sibling, 0 replies; 3+ messages in thread
From: Christopher Kings-Lynne @ 2002-08-28 03:54 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; pgsql-sql
What if you try this:
SELECT date_part('epoch','2002-08-28'::TIMESTAMP WITH TIME ZONE)
It's probably 8 hours time different to GMT or somethign like that...
Chris
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Josh Berkus
> Sent: Wednesday, 28 August 2002 11:31 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Calculation Error on Epoch?
>
>
> Folks,
>
> 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?
> Suggestions?
>
> -Josh Berkus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Calculation Error on Epoch?
@ 2002-08-28 04:14 Tom Lane <tgl@sss.pgh.pa.us>
parent: Josh Berkus <josh@agliodbs.com>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2002-08-28 04:14 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql@postgresql.org, Thomas Lockhart <lockhart@fourpalms.org>
"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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-08-28 04:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-28 03:30 Calculation Error on Epoch? Josh Berkus <josh@agliodbs.com>
2002-08-28 03:54 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-08-28 04:14 ` Tom Lane <tgl@sss.pgh.pa.us>
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