Re: Number of days in a tstzrange?

From: skinner(at)britvault(dot)co(dot)uk (Craig R(dot) Skinner)
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Number of days in a tstzrange?
Date: 2013-10-30 10:40:15
Message-ID: 20131030104015.GA12587@teak.britvault.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2013-10-29 Tue 11:34 AM |, Craig R. Skinner wrote:
>
> -- if a subscription is ceased same day it's started,
> -- that day is still chargable, so bump it
> IF billable_days < 1
> THEN
> billable_days := 1;
> END IF;
> ...
> ...
>

This is more accurate:

-- If a subscription billing_period ends part way through a day,
IF upper(billable_item.billable_period)::time <> time 'allballs'
THEN
-- That partial day is still chargable, so bump it
billable_days := billable_days + 1;
END IF;

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gavin Flower 2013-10-30 18:21:50 Re: Number of days in a tstzrange?
Previous Message M. D. 2013-10-29 13:19:22 Re: Re: sum of until (running balance) and sum of over date range in the same query