SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Current Week
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vack
Constraint Violating Yak Guru

USA
464 Posts

Posted - 03/29/2012 :  14:41:09  Show Profile  Reply with Quote
Can anyone tell me why this statement is returning 13 for the current week when it should be 64 or 65??

select DATEPART(wk, GETDATE() - '2011-01-01') AS currentweek

jimf
Flowing Fount of Yak Knowledge

USA
2865 Posts

Posted - 03/29/2012 :  14:46:21  Show Profile  Reply with Quote
Because GETDATE() - '2011-01-01' is March 30, 1901

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

jimf
Flowing Fount of Yak Knowledge

USA
2865 Posts

Posted - 03/29/2012 :  14:47:26  Show Profile  Reply with Quote
select datediff(wk,'2011-01-01',GETDATE())

Will return 65

Everyday I learn something that somebody else already knew
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000