Thread: Time

Time

From
Rob Kirkbride
Date:
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?

Thanks for any help,

Rob

Re: Time

From
Ragnar Hafstað
Date:
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