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

  • Home
  • SEARCH
  • 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 6844655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:24:18+00:00 2026-05-27T00:24:18+00:00

I am using two dateTimePicker’s, and lets say I’ve chosen 11-11-2011 on the first,

  • 0

I am using two dateTimePicker’s, and lets say I’ve chosen 11-11-2011 on the first, and 17-11-2011 on the last. Now I want to get the dates between these two dates. I just want to get a result like this:

11-11-2011 
12-11-2011 
13-11-2011 
14-11-2011 
15-11-2011 
16-11-2011 
17-11-2011 

How am I supposed to do this ?

I’ve tried to make it out from the question by James Hill, but couldnt figure it out.
Thanks,

  • 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-05-27T00:24:18+00:00Added an answer on May 27, 2026 at 12:24 am

    Give this a try:

    DateTime start = DateTime.Today;
    DateTime end = DateTime.Today.AddDays(7);
    
    for (DateTime current = start; current <= end; current = current.AddDays(1))
    {
        Console.WriteLine(current);
    }
    

    I like using a for-loop for this kind of stuff, since I do often miss them in modern .NET projects 🙂

    A possible helper method:

    static IEnumerable<DateTime> GetRange(DateTime start, DateTime end)
    {
        for (DateTime current = start; current <= end; current = current.AddDays(1))
        {
            yield return current;
        }
    }
    

    Important If you have a time-portion as well, the condition must be changed to current.Date <= end.Date

    Edit Changed so that the boundaries are included, I previously only provided the dates in-between.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the datetimepicker to get two dates. They are coming out like this:
I currently am using two stylesheets to get my intended output. The first stylesheet
I am currently using two catch blocks after a try block. The first catches
I'm using two bindings TCP and HTTP. I want to give mex data on
Using VB 6 Using two DTPicker in my project, I want to select monthly
I'm using two tables. First (friendlist), which contains users who are on the list
I guys i'm using a datetimepicker by trentrichardson.com. I have a form with two
I am using two view controllers. On button action of first view controller i
I am using two managed object contexts in my iOS app. The first context
I'm using two tables in the database. The first contains data related to the

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.