Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Harry Tuttle Newsgroups: comp.databases.postgresql Subject: Re: work with intervals Date: Fri, 8 Jan 2016 10:46:46 +0100 Lines: 31 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net E1qZNoR0GouEvIOhV6V14QCWVSxrp83w6W/RzF3VSCl3Py5A4= Cancel-Lock: sha1:XgCgXsXdW0+xQC9ILxYhud4aVn0= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: Xref: csiph.com comp.databases.postgresql:695 Magnus Warker schrieb am 06.01.2016 um 13:39: > Hi, > > I would like to store intervals in a table. > > When I write '55:39', it's shown (in pgAdmin) as '55:39'. So it's not somewhat normalized. > > What does it mean then? 55 minutes and 39 seconds or 55 hours and 39 minutes? > > When I create a view that divides two intervals, I get results like '08:23:01.543116' (shown in the view in pgAdmin). > Can I format it somehow to show only minutes and seconds, preferrably in the view itself? You can use the justify_xxx() functions for this: select justify_hours(interval '55:43') returns: 0 years 0 mons 2 days 7 hours 43 mins 0.00 secs Details in the manual: http://www.postgresql.org/docs/current/static/functions-datetime.html I don't know what you mean with "dividing" intervals. Dividing a duration by another does not really make sense to me.... Btw: you are betting off posting to the Postgres mailing lists than to comp.databases.postgresql. If you prefer newsgroup style reading (as I do) you can register with the mailing list with the option to not deliver mail, and then subscribe to the ntp mirrors of the mailing lists on news.gmane.org