On 08/03/2012 08:06 AM, Andreas Kretschmer wrote:
>
> Hi all,
> great feature, but i can't find a TIMERANGE, i want to store time-ranges, for
> instance [10:00:00,16:00:00), how can i do that?
>
>
>
> Regards, Andreas
Time ranges could be more complicated than you realize. You'd have
problems if you wanted to create a range that extends beyond midnight.
Say for example, you need a range from 10 PM to 4 AM. We realize it as
being 4AM the following day, But if you tried to enter it into a time
range, it would throw an exception for having an upper bound smaller
than the lower bounds.
You might have to use something like int4range to represent minutes or
seconds of the day and add some helper functions. So for minutes you'd
represent 10 PM to 4 AM as [1320, 1680)