Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #695

Re: work with intervals

From Harry Tuttle <SOZRBLNTLEEE@spammotel.com>
Newsgroups comp.databases.postgresql
Subject Re: work with intervals
Date 2016-01-08 10:46 +0100
Message-ID <df9esaFih4aU1@mid.individual.net> (permalink)
References <n6j1un$lbj$1@news.m-online.net>

Show all headers | View raw


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



Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

work with intervals Magnus Warker <magnux@mailinator.com> - 2016-01-06 13:39 +0100
  Re: work with intervals Harry Tuttle <SOZRBLNTLEEE@spammotel.com> - 2016-01-08 10:46 +0100
    Re: work with intervals Magnus Warker <magnux@mailinator.com> - 2016-01-08 19:57 +0100
    Re: work with intervals Magnus Warker <magnux@mailinator.com> - 2016-01-09 06:56 +0100
      Re: work with intervals Harry Tuttle <SOZRBLNTLEEE@spammotel.com> - 2016-01-09 10:07 +0100
        Re: work with intervals Magnus Warker <magnux@mailinator.com> - 2016-01-19 06:43 +0100
          Re: work with intervals Dimitri Fontaine <dimitri@2ndQuadrant.fr> - 2016-01-19 10:20 +0100
            Re: work with intervals Magnus Warker <magnux@mailinator.com> - 2016-01-31 06:04 +0100

csiph-web