Re: Need to omit time during weekends from age calculations - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Need to omit time during weekends from age calculations
Date
Msg-id CAFj8pRB8Y+mvHRvtdiy_ArhaGzpaZu=o10hPLAuEvjwRGHB=mg@mail.gmail.com
Whole thread Raw
In response to Re: Need to omit time during weekends from age calculations  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: Need to omit time during weekends from age calculations  (David Gauthier <davegauthierpg@gmail.com>)
List pgsql-general


po 7. 6. 2021 v 21:17 odesílatel Ron <ronljohnsonjr@gmail.com> napsal:
On 6/7/21 2:12 PM, David Gauthier wrote:
Hi:

I suspect I'm not the first to ask about this but couldn't find anything after googling for a bit.  So here goes....

I'd like to get the "age" difference between two times which span either all or part of a weekend but exclude any time that transpired during the weekend.  
Example (please pardon the non-timestamp vals here...)

age('Monday-Noon','Prev-Friday-Noon')
would give me '1 day'.

...and...

age('Sunday-Noon','Prev-Friday-Noon')
would give me '12 hours'

You get the picture. 

Has this wheel already been invented ?
I don't see an easy way to do this off-hand.
All Ears :-)

Thanks in Advance.

You seem to be asking about counting work days.  Am I misunderstanding?

orafce has functions for business calendar  with holidays


plvdate.add_bizdays(day date, days int) date

Regards

Pavel


--
Angular momentum makes the world go 'round.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Need to omit time during weekends from age calculations
Next
From: David Gauthier
Date:
Subject: Re: Need to omit time during weekends from age calculations