Solved

c# code for the next working day (UK)

Posted on 2008-10-03
3
2,139 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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