Re: Regarding interval conversion functions and a seeming lack of usefulness - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Regarding interval conversion functions and a seeming lack of usefulness
Date
Msg-id E46962A9-3ABD-49CE-B512-111170CAAB9D@solfertje.student.utwente.nl
Whole thread Raw
In response to Regarding interval conversion functions and a seeming lack of usefulness  (Bill Moran <wmoran@collaborativefusion.com>)
Responses Re: Regarding interval conversion functions and a seeming lack of usefulness
List pgsql-general
On Feb 27, 2008, at 3:47 PM, Bill Moran wrote:
> Something like:
> $ SELECT CONVERT('12 days 13 hours'::INTERVAL AS hour);
>  hour
> ------
>    301
> $ SELECT CONVERT('6 hours 17 minutes'::INTERVAL AS hour);
>  hour
> ------
> 6.2833
>
> Am I approaching this problem wrong? or is there something out there
> and my Google skills are lacking?

One of the obvious problems with this is that you cannot convert
months to something more fine-grained without knowing the date the
interval is relative to. I mean, what would be the answer of:

$ SELECT CONVERT('2 months'::INTERVAL AS days);

This month that would be 60 days, next month 61, this month next year
59, etc.
And I haven't even started on leap seconds and daylight saving time
yet...

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,47c69dd2233091191611641!



pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: debug nonstandard use of \\ in a string literal
Next
From: Sam Mason
Date:
Subject: Re: How to "paste two tables side-by-side"?