Re: Number of days in a tstzrange?

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: "Craig R(dot) Skinner" <skinner(at)britvault(dot)co(dot)uk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Number of days in a tstzrange?
Date: 2013-10-30 18:21:50
Message-ID: 52714E3E.2080306@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 30/10/13 23:40, Craig R. Skinner wrote:
> 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;
>
>
>
even for 1 second over???

I would expect any court of law to set a higher threshold!

Cheers,
Gavin

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Diway 2013-11-04 20:22:36 json and aggregate
Previous Message Craig R. Skinner 2013-10-30 10:40:15 Re: Number of days in a tstzrange?