By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,084 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,084 IT Pros & Developers. It's quick & easy.

"calculate number of weeks between two dates"

P: n/a
Can someone tell me how to calculate the number of weeks between two dates.
Your help is appreciated.

Thanks, George
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Subtract the two dates to get a TimeSpan, use its Days property and divide
it by 7.

-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls


"George" <Ge****@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com...
Can someone tell me how to calculate the number of weeks between two
dates.
Your help is appreciated.

Thanks, George

Nov 21 '05 #2

P: n/a
You can use DateDiff() function (VB.Net) to for getting number of weeks
between two dates

Function No_of_Weeks(FromDate as Date) as String
No_of_Weeks = "No of weeks from today : " & DateDiff("w", Now,
FromDate)
End Function

Other you can also use DateDiff function of SQL Server for computing no
of weeks between dates

SELECT DATEDIFF(week, '2005-01-01', getdate()) AS no_of_week

Regards
Hari Sharma
NIIT Technologies

Nov 21 '05 #3

P: n/a
Thank you very much. It worked.

"Hari" wrote:
You can use DateDiff() function (VB.Net) to for getting number of weeks
between two dates

Function No_of_Weeks(FromDate as Date) as String
No_of_Weeks = "No of weeks from today : " & DateDiff("w", Now,
FromDate)
End Function

Other you can also use DateDiff function of SQL Server for computing no
of weeks between dates

SELECT DATEDIFF(week, '2005-01-01', getdate()) AS no_of_week

Regards
Hari Sharma
NIIT Technologies

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.