Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:51:08+00:00 2026-06-05T18:51:08+00:00

I have two text-boxes which are used to select a From and a To

  • 0

I have two text-boxes which are used to select a From and a To date. I need to have a loop where the outer loop will be for a year and the inner loop will run for each month.

Problem is with the code below, if I choose 11/01/2011 and 06/30/2012, my month loop runs once for month 11. After that the loop exits.. Any help is appreciated.

I’m using the code below to look into a SharePoint Calendar List (using CAML query) and fetch number of times 3, 5 consecutive days a certain room is available excluding week ends. Idea is to use CAML query to get the number of free days for each month and keep repeating till the last selected month.

int year = 0, month = 0; 
for (year = Calendar1.SelectedDate.Year; year <= Calendar2.SelectedDate.Year; year++)
{
  int i = year;
  for (month = Calendar1.SelectedDate.Month; month <= Calendar2.SelectedDate.Month; month++)
  {
    int j = month;
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:51:09+00:00Added an answer on June 5, 2026 at 6:51 pm

    If I understand you correctly you want to iterate through each month between the 2 dates. If so, this should work:

    var dt2 = Calendar2.SelectedDate.Year;
    var current = Calendar1.SelectedDate;
    while (current < dt2)
    {
      current = current.AddMonths(1);
      //do your work for each month here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two text boxes which is loaded with jquery masked date input .
I have two text boxes which accept Start Date and End Date respectively, in
I have two text boxes (select) which I want to change the contents of
I have two input text boxes which are decimal. The sum of the two
I have a table which has two text boxes and an image beside it
I have a user control in my wp7 application which contains two text boxes
I have a form with two text boxes, one select drop down and one
i have two text boxes which the user should enter one of them i
I am trying to have two input boxes, and a button which will update
I have a chrome extension in which I have two text boxes, one for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.