Re: TIME column manipulation/comparison hangups
От | Raymond O'Donnell |
---|---|
Тема | Re: TIME column manipulation/comparison hangups |
Дата | |
Msg-id | 490F4C9C.7040101@iol.ie обсуждение исходный текст |
Ответ на | TIME column manipulation/comparison hangups (Bill Moran <wmoran@collaborativefusion.com>) |
Список | pgsql-general |
On 03/11/2008 19:01, Bill Moran wrote: > It seems as if EXTRACT() will work, but it sure feels hacky > to do: > > (extract(hours from now()) = extract(hours from time_column) > AND > (extract(minutes from now()) = extract(minutes from time_column) I'd have thought that this was the correct way to do it. Anyway, you could encapsulate this in a function to make re-use easier (the following hasn't been tested): create function is_same_minute(time with time zone, time with time zone) returns bool as $$ select (extract(hours from $1) = extract(hours from $2)) and (extract(minutes from $1) = extract(minutes from $2)); $$ language sql; Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@iol.ie Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------
В списке pgsql-general по дате отправления: