Re: strange TIME behaviour

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: strange TIME behaviour
Дата
Msg-id 46EBCCCE.6080004@cox.net
обсуждение исходный текст
Ответ на strange TIME behaviour  (rihad <rihad@mail.ru>)
Список 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 по дате отправления:

Предыдущее
От: rihad
Дата:
Сообщение: strange TIME behaviour
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: strange TIME behaviour