Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Difference between two dates in weeks Expand / Collapse
Author
Message
Posted Tuesday, May 27, 2008 10:46 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, January 29, 2013 6:18 AM
Points: 0, Visits: 93
Comments posted to this topic are about the item Difference between two dates in weeks
Post #507411
Posted Wednesday, May 28, 2008 7:13 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, May 24, 2012 8:40 AM
Points: 12, Visits: 38
Couldn't you just use the following?

SELECT DATEDIFF(wk,@StartDate,@EndDate)

Post #507648
Posted Wednesday, May 28, 2008 8:29 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, January 25, 2014 2:45 PM
Points: 62, Visits: 125
I don't think that datediff(wk) salutes @@DateFirst.


DateFirst StartDate EndDate DateDiff WeekDiff
--------- ----------- ----------- ----------- -----------
7 Sun 25May08 Mon 26May08 0 0
7 Mon 19May08 Sun 01Jun08 2 2
7 Sat 24May08 Sun 25May08 1 1

DateFirst StartDate EndDate DateDiff WeekDiff
--------- ----------- ----------- ----------- -----------
1 Sun 25May08 Mon 26May08 0 1
1 Mon 19May08 Sun 01Jun08 2 1
1 Sat 24May08 Sun 25May08 1 0
Post #507706
Posted Wednesday, May 28, 2008 8:43 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, January 25, 2014 2:45 PM
Points: 62, Visits: 125
Says here that DATEDIFF doesn't consider DATEFIRST.

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=239958
Post #507726
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse