Click here to Skip to main content
15,881,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am a postgres newbie,


Is there a way to get/predict the date of deadline using date posted and add just 20 days but must remove saturday and sunday in postgres.

Example:
posted date: 09-01-2022
deadline: ?

What I have tried:

Please correct:
with daysdt as (
select dd, extract(DOW from dd) dw
from generate_series('2022-08-01'::date , '2022-08-31'::date, '1 day'::interval) dd
)
select dd::date,dd::date + 20 from daysdt where dw not in (6,0)



For 08/01/2022 it returns 08/21/2022 instead of 08/26/2022,
please help me, it should remove saturday and sunday then add 20 days after to get the deadline date, thanks
Posted
Updated 18-Sep-22 22:29pm
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900