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 6192673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:59:01+00:00 2026-05-24T02:59:01+00:00

Working in Visual Studio with C#. I’m making a piece of software for a

  • 0

Working in Visual Studio with C#. I’m making a piece of software for a small office that captures lawsuits. Once a lawsuit is captured, the office has 15 days to send some documents to the tribunal. So deadLine is in 15 days.

But if there is for example, and update (update1) to the lawsuit, the office now has a new deadLine to send update1 documents.

So, deadLine for Capture is dd/MM/yyy
Then, deadLine for update1 is dd/MM/yyyy

But I need to exclude all non labor days, so the deadLines do not display any non labor days. Example:

Capture: 15 days
Update1: 5 days
Update2: 10 days
Update3: 7 days

So, if I capture today, July 28 2011, 15 days should be added to the deadLine variable, which would be August 12, but I have to exclude non labor days from a calendar. For example August 12 2011.

I’ve turned the DatePicker value to string, with format (dd/MM/yyyy), and I’m comparing it to a list of strings of non-valid days, with format (dd/MM/yyyy).

And if the deadLine falls on one of these days, I convert deadLine to dateTime, add 1 day, until it does not fall on one of these days. Then save the final dateTime value as the new deadLine.

Example:

string DeadLine;
string NonValidDay001 = 12/08/2011;
string NonValidDay001 = 15/08/2011;
string NonValidDay001 = 19/08/2011;

DeadLine = DatePicker01.Value.AddDays(15).ToString("dd/MM/yyyy");

while (DeadLine == NonValidDay001 | DeadLine == NonValidDay001 | DeadLine == NonValidDay001)
{
    dateTime dt = Convert.toDateTime(DeadLine);
    dt.AddDays(1).ToString("dd/MM/yyyy");
    DeadLine = dt;
}

The problem I’m having is, it is not adding days to the dealine if deadline matches non-valid days.

What I’m doing is not working in any way.

Could anyone enlighten me please. (=

  • 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-24T02:59:02+00:00Added an answer on May 24, 2026 at 2:59 am

    If you wanted to skip over labour days within the time period (i.e. within the 15 days) then you could use the following (untested, typed straight in here):

    public DateTime AddDaysExcluding(DateTime startDate, int days, params DateTime[] excludedDays)
    {
        while(days != 0)
        {
            if (excludedDays.Contains(startDate))
                startDate = startDate.AddDays(1);
    
            startDate = startDate.AddDays(1);
            days--;
        }
    
        if (excludedDays.Contains(startDate))
            startDate = startDate.AddDays(1);
    }
    

    Example usage:

    DateTime deadline = AddDaysExcluding(DatePicker01.Value, 15,
        new DateTime(2011, 8, 12), new DateTime(2011, 8, 15), new DateTime(2011, 8, 19));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in Visual Studio 2005 and have added a text file that needs
I'm working on a visual studio 2005 vb.net windows forms project that's been around
I am working with a Visual Studio 2005 C++ solution that includes multiple projects
I've created a working Visual Studio 2008 web setup project that builds an MSI
When working with Visual Studio, I always see that @ character when selecting font
Working with Visual Studio (I'm using 2008) I have started to notice that when
I am working on a project that uses visual studio's GUI DB designer to
When working with Visual Studio and adding a reference to a project you are
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I am working in Visual Studio 2008 on an ASP.NET application, which has been

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.