Here is the code,
public int Get_No_Of_Weeks(DateTime FromDate, DateTime ToDate)
{
int No_Of_Days = ToDate.Subtract(FromDate).Days;
int no_of_weeks = (int)No_Of_Days / 7;
return (int)No_Of_Days / 7;
}
Response.Write(Get_No_Of_Weeks(DateTime.Now, DateTime.Now.AddMonths(4)))
Here,we will calculate no of weeks in between May and September so number of weeks would be 17