Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Add

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-05-05 : 16:49:39
Dear All,

I want to know what will be the next monday date based on getdate().Can any body help

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-05-05 : 17:14:18
[code]select NextMonday = dateadd(dd,((datediff(dd,'17530101',getdate())+7)/7)*7,'17530101')[/code]Results:[code]NextMonday
------------------------------------------------------
2010-05-10 00:00:00.000

(1 row(s) affected)[/code]

CODO ERGO SUM
Go to Top of Page
   

- Advertisement -