Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2203
  • Last Modified:

c# code for the next working day (UK)

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
mareq80
Asked:
mareq80
2 Solutions
 
joesthebighmoeCommented:
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
 
Anurag ThakurCommented:
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
 
mastooCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now