Re: [SQL] time intervals

Поиск
Список
Период
Сортировка
От George Moga
Тема Re: [SQL] time intervals
Дата
Msg-id 37297D89.1B186907@flex.ro
обсуждение исходный текст
Ответ на time intervals  (JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>)
Список pgsql-sql
JT Kirkpatrick wrote: <blockquote type="CITE">I have two fields, timein & timeout, both defined as type "time". 
howcan <br />i get the difference between the two??  i am connecting to postgres through <br />access97 and trying to
runa simple query to show me timeout, timein, and <br />timeout-timein, but the calculation is returning an error.
<p>thanksin advance!  jt</blockquote><p><br />If your field is defined by tipe "time", the date is not important. <p>In
thiscase you can use the age(datetime, datetime) in this mode: <p><tt>a. timein <
timeout:</tt><tt></tt><p><tt>test=>select age(datetime('today'::date,'10:00:15'::time),
datetime('today'::date,'12:25:24'::time));</tt><br/><tt>age</tt><br /><tt>----------------------------</tt><br /><tt>@
2hours 25 mins 9 secs ago</tt><br /><tt>(1 row)</tt><p>or <p><tt>b. timein > timeout:</tt><br /><tt>test=> select
age(datetime('today'::date,'10:00:15'::time),datetime('today'::date,'2:25:24'::time));</tt><br /><tt>age</tt><br
/><tt>-------------------------</tt><br/><tt>@ 7 hours 34 mins 51 secs</tt><br />(1 row) <br />  <p>I use PostgreSQL
v6.5.0(09-04-1999) on Red Hat LINUX 5.2 with 2.2.5 kernel. <br />-- <br /> Best,<br />   George Moga,<br />  
george@flex.ro<br/>   Braila,ROMANIA <br />  

В списке pgsql-sql по дате отправления:

Предыдущее
От: Mark Jewiss
Дата:
Сообщение: Re: [SQL] time intervals
Следующее
От: José Soares
Дата:
Сообщение: Re: [SQL] time intervals