Solved

c# code for the next working day (UK)

Posted on 2008-10-03
3
2,182 Views
Last Modified: 2013-11-07
Does anyone have a custom class writen in c# that would calculate next working day (exclude sat, sun and bank holidays) after feeding it with custom date.  I am using .Net 2.0?
0
Comment
Question by:mareq80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Assisted Solution

by:joesthebighmoe
joesthebighmoe earned 50 total points
ID: 22635884
The DateTime class has a property called DayOfWeek. That can handle excluding Saturdays and Sundays. The problem with Bank Holidays is problematic because of unseen future handling of holidays. At least here in the States.
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 75 total points
ID: 22638607
there is a webservice available which can provide you with the bank holiday details for UK
http://www.holidaywebservice.com/Holidays/servicesAvailable.aspx

you can fetch data from the web service and save it in the database and then do you operations to find out whether today is a working day or a bank holiday
happy coding
0
 
LVL 21

Expert Comment

by:mastoo
ID: 22641281
Maybe combine Joe and Raqi's answers: Wrap the DateTime class to use it's weekday functionality and use .Net's serialize to store a collection of the next several years worth of holidays and have your class check that collection.  Most important - if a date is fed in that is beyond the last holiday in the list: throw an error that tells the user to track you down and have you add a few more years worth of holidays :-)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question