"calculate number of weeks between two dates"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me how to calculate the number of weeks between two dates.


Your help is appreciated.

Thanks, George
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top