Solved

c# code for the next working day (UK)

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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