From: | Sam Gendler <sgendler(at)ideasculptor(dot)com> |
---|---|
To: | David Gauthier <davegauthierpg(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Need to omit time during weekends from age calculations |
Date: | 2021-06-08 01:11:59 |
Message-ID: | CAEV0TzBRb0UTy4pmQH2vSaiMA5vf1TK8HJ7TiVOZu89Sah8EXg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Jun 7, 2021 at 2:01 PM David Gauthier <davegauthierpg(at)gmail(dot)com>
wrote:
> Thanks Joe. I think the nonweekendhours solution should be good enough
> for what I need.
>
> Yes, holidays too would be the best. But for practical purposes,
> excluding Sat&Sun is good enough for this particular problem.
>
I've solved this in the past with a time dimension table that includes
columns labeling weekends and holidays. Then I can query for the count of
intervals (for whatever interval size my time dimension uses) in the date
range joined to time_dimension where weekday is true and holiday is false,
and multiply the count by the number of hours in an interval.
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2021-06-08 01:36:54 | Re: Database issues when adding GUI |
Previous Message | Sam Gendler | 2021-06-08 01:05:22 | Re: Database issues when adding GUI |