Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
IS there a way to find out if the date falls on a weekend
I am trying to do some date manipulations in my stored procedure... For example Current date + 40 days = new date...
However i need to know if this new date falls on a weekend i.e Saturday/Sunday.. if it does then i need to find the immediate working day which falls on a monday
How can i achieve this in my SQL Server stored procedure... i'm using SQL Server 2000...
Thanks in Advance,
Microsoft SQL Server
8/22/2022 - Mon
IF SELECT DATEPART(dw,GETDATE()) = 7 OR SELECT DATEPART(dw,GETDATE()) = 1
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
select dateadd(d,case datepart(dw,target) when 7 then 2
when 1 then 1 else 0 end) as target
from (select dateadd(d,+40,getdate()) as target ) as x
for all the suggestion about Make sure about the
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent