Collindsouza
asked on
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,
Collin
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,
Collin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
like this...
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
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
DateFirst
DateFirst
Print 'WeekEnd'