| From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: strange TIME behaviour |
| Date: | 2007-09-15 12:15:10 |
| Message-ID: | 46EBCCCE.6080004@cox.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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-----
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Fuhr | 2007-09-15 12:25:11 | Re: strange TIME behaviour |
| Previous Message | rihad | 2007-09-15 11:45:02 | strange TIME behaviour |