Re: fomatting an interval (resend)
От | greg@turnstep.com |
---|---|
Тема | Re: fomatting an interval (resend) |
Дата | |
Msg-id | 3616683024ca631d95ed19e803a6b2fa@biglumber.com обсуждение исходный текст |
Ответ на | Re: fomatting an interval (resend) (lyris-pg@tibit.com) |
Список | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >>> Okay, so extract() doesn't fit the bill either. How do I get the >>> difference between two timestamps in terms of days, expressed as an >>> integer? Moreover, how do I get any interval expressed in those >>> terms? >> select round((extract(epoch from finish) - >> extract(epoch from start))/(60*60*24)) from timetable; >How would that differ from the query below? > >select round(extract(epoch from (finish - start))/(60*60*24)) from >timetable; No real difference - the first is extracting from timestamps, the second is extracting from an interval. The second is more compact, but I prefer the first as it is a little more explicit in what is happening. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200305301433 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD8DBQE+16QZvJuQZxSWSsgRAhPyAKC9lz5pAr7W94Sm6MPXp77CoG04UgCg062W 0ylMMu/79liaR48hG3tIw2c= =zQTl -----END PGP SIGNATURE-----
В списке pgsql-general по дате отправления: