Click here to Skip to main content
15,120,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have two dropdown list. Each one contain start week and End week Details.

Start Week : 1-2006(1st Week,year 2006) to 52-2020 (52 week,2020 Year)
End Week : 1-2006 to 52-2020

if i select startweek "1-2006" (1st week,2006 year) and EndWeek "41-2007" (41st week,2007 Year) then i want to get the count of week in between start week and end week.

Note : start week and end week data Hardcoded in the database till 2020. like 1-2006 to 52-2020 including leap year.

Just i want to count the number of weeks based on start week and end week dropdown.

How we can do that.

pls. help and give me the solution.

gani7787 4-Jul-11 2:21am
Any help. pls.
walterhevedeich 4-Jul-11 3:08am
What language are you using?
OriginalGriff 4-Jul-11 3:11am
We need more information: "drop-down" doesn't really tell us what you are using. C#? VB? ASP.NET? Winforms? Web?
Use the "Improve question" widget to edit your question and provide better information.
gani7787 4-Jul-11 3:33am
gani7787 4-Jul-11 4:25am
any help..
Smithers-Jones 4-Jul-11 6:59am
Wow, are we impatient... Give it some time.

1 solution

public int returnTotWeeks(string s1, string s2)
string[] str1 = s1.Split('-');
string[] str2 = s2.Split('-');
int d1 = (Convert.ToInt32(str2[1]) - Convert.ToInt32(str1[1])) * 52;
return d1 + (Convert.ToInt32(str2[0]) - Convert.ToInt32(str1[0])) + 1;
catch ( Exception ex)
Response.Write("Error due to :" + ex.StackTrace);
return 0;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900