Re: Time - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: Time
Date
Msg-id 1112621536.19933.17.camel@localhost.localdomain
Whole thread Raw
In response to Time  (Rob Kirkbride <rob.kirkbride@thales-is.com>)
List pgsql-general
On Mon, 2005-04-04 at 13:49 +0100, Rob Kirkbride wrote:
> Hi,
>
> I'm trying to fetch out the epoch value of  a time, the data type is
> 'timestamp with time zone'. When I do select extract(epoch from time) it
> returns a fractional part as well.
> Am I doing this the correct way? Is the fractional part microseconds?

no, it is fractions of a second.

test=# select extract(epoch from '2005-04-04 14:00:00.000000
+00'::timestamptz);
 date_part
------------
 1112623200
(1 row)

test=# select extract(epoch from '2005-04-04 14:00:00.123400
+00'::timestamptz);
    date_part
-----------------
 1112623200.1234
(1 row)

the accuracy probably depends on your platform

gnari



pgsql-general by date:

Previous
From: Rob Kirkbride
Date:
Subject: Time
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Strange plpgsql performance -- arithmetic, numeric()