Solved

c# code for the next working day (UK)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now