Re: strange TIME behaviour - Mailing list pgsql-general

From Ron Johnson
Subject Re: strange TIME behaviour
Date
Msg-id 46EBCCCE.6080004@cox.net
Whole thread Raw
In response to strange TIME behaviour  (rihad <rihad@mail.ru>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/15/07 06:45, rihad wrote:
> Can someone please explain to me why these two give different results?
> The idea is to get the number of seconds past 00:00:00, so the second
> one is obviously correct.

How about:

select extract(hour from current_time)*3600
     + extract(minute from current_time)*60
     + extract(second from current_time);

> foo=> select extract(epoch from current_time);
>   date_part
> --------------
>  42023.026348
> (1 row)
>
> foo=> select extract(epoch from cast(current_time as time));
>   date_part
> --------------
>  60030.824587
> (1 row)
>
>
> Isn't current_time already a time? Why is the cast necessary?



- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG68zOS9HxQb37XmcRAl7KAKDNKaUwMn7mpwYiE1huKd4KvW+T+ACeM8lC
6AZEwlHNUwOucQ3jSWRfqGM=
=0GIE
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: rihad
Date:
Subject: strange TIME behaviour
Next
From: Michael Fuhr
Date:
Subject: Re: strange TIME behaviour