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.
Author |
Topic |
chipembele
Posting Yak Master
106 Posts |
Posted - 2009-06-22 : 03:07:07
|
HiI need to calculate the number of days and weeks between two dates. The two dates are startdate and enddate columns.Can anyone advise on the syntax please? The examples I have seen are for putting the actual dates in or calculating from the system date.Thankyou |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-22 : 03:09:02
|
days => datediff(day, startdate, enddate)weeks => datediff(week, startdate, enddate) KH[spoiler]Time is always against us[/spoiler] |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-06-22 : 03:10:38
|
see datediff details in bolex:-declare @start datetime, @end datetimeselect @start = '6/2/2009', @end = '6/22/2009'select datediff(d,@start,@end)select datediff(wk,@start,@end) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
chipembele
Posting Yak Master
106 Posts |
Posted - 2009-06-22 : 03:31:36
|
Thanks for your help. |
|
|
|
|
|
|
|