Re: Regarding interval conversion functions and a seeming lack of usefulness

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Bill Moran <wmoran(at)collaborativefusion(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regarding interval conversion functions and a seeming lack of usefulness
Date: 2008-02-28 12:04:44
Message-ID: E46962A9-3ABD-49CE-B512-111170CAAB9D@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2008-02-28 13:05:57 Re: UUID-OSSP for windows.
Previous Message Sam Mason 2008-02-28 11:35:59 Re: How to "paste two tables side-by-side"?