Re: Intervals and ISO 8601 duration - Mailing list pgsql-general

From Tom Lane
Subject Re: Intervals and ISO 8601 duration
Date
Msg-id 892688.1673657835@sss.pgh.pa.us
Whole thread Raw
In response to Re: Intervals and ISO 8601 duration  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Intervals and ISO 8601 duration  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
Ken Tanzer <ken.tanzer@gmail.com> writes:
> Not really.  My original question was:
>> [since intervals are stored internally as months, days and microseconds...]
>> What Postgres actually stores for an interval is three fields:
>> months, days, and microseconds.
>> *Is there a way to view/extract this raw data for any given interval?*

Given what extract() provides,

stored months = years * 12 + months

stored days = days

stored usec = reconstruct from hours+minutes+seconds+microseconds

Perhaps it wouldn't be a bad idea to provide a couple more extract()
keywords to make that easier.

            regards, tom lane



pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Intervals and ISO 8601 duration
Next
From: Ken Tanzer
Date:
Subject: Re: Intervals and ISO 8601 duration