Re: [SQL] Formatting an Interval

2005-01-03 Thread Edmund Bacon
Michael Fuhr wrote: On Fri, Dec 31, 2004 at 11:37:32AM -0500, Jamison Roberts wrote: All of the functions that i've looked at seem to only extract parts from Intervals. What I need to do is to format the interval. For instance, I have a Interval with the value 1 day 07:57:52. I would like that

Re: [SQL] Formatting an Interval

2005-01-02 Thread Pierre-Frédéric Caillaud
Note that there will be a loss of precision as an interval of 1 month, for instance, does not mean any specific number of days, as : 1 february + 1 month = 1 march (1 month = 28 or 29 days) 1 december + 1 month = 1 january(1 month = 31 days) Same for years etc. -

Re: [SQL] Formatting an Interval

2005-01-02 Thread Kretschmer Andreas
am Sun, dem 02.01.2005, um 17:19:23 +0100 mailte Karel Zak folgendes: > > You could write a function to format the interval. For example, > > with PL/pgSQL you could use EXTRACT(epoch FROM interval_value) to > > convert the interval to a number of seconds; convert that to hours, > > minutes, and

Re: [SQL] Formatting an Interval

2005-01-02 Thread Michael Fuhr
On Sun, Jan 02, 2005 at 05:19:23PM +0100, Karel Zak wrote: > On Fri, 2004-12-31 at 12:41 -0700, Michael Fuhr wrote: > > > You could write a function to format the interval. For example, > > with PL/pgSQL you could use EXTRACT(epoch FROM interval_value) to > > convert the interval to a number of se

Re: [SQL] Formatting an Interval

2005-01-02 Thread Karel Zak
On Fri, 2004-12-31 at 12:41 -0700, Michael Fuhr wrote: > On Fri, Dec 31, 2004 at 11:37:32AM -0500, Jamison Roberts wrote: > > > All of the functions that i've looked at seem to only extract parts > > from Intervals. What I need to do is to format the interval. For > > instance, I have a Interval

Re: [SQL] Formatting an Interval

2004-12-31 Thread Michael Fuhr
On Fri, Dec 31, 2004 at 11:37:32AM -0500, Jamison Roberts wrote: > All of the functions that i've looked at seem to only extract parts > from Intervals. What I need to do is to format the interval. For > instance, I have a Interval with the value 1 day 07:57:52. I would > like that in HH:MM:SS.

[SQL] Formatting an Interval

2004-12-31 Thread Jamison Roberts
All of the functions that i've looked at seem to only extract parts from Intervals. What I need to do is to format the interval. For instance, I have a Interval with the value 1 day 07:57:52. I would like that in HH:MM:SS. So in the example the output would be 31:57:52. How can this be done?