Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to discover if some day is a workday

Is there some library, pattern or common way deal with workdays? I mean, is there some relatively well adopted way to know if some day is a workday and not weekend, holiday etc.?

Also, supposing there is such thing, would it be helpful to discover if the day has some "detail"? For example, here in Brazil we use to work only in the afternoon of the Ash Wednesday. Is there some kind of flexible framework for dealing with such variations?

I could implement this kind of business logic without any difficulty but I would not like to reinvent the wheel and other users suggestions can be helpful. Also, it seems a very recurrent problem.

Thanks in advance!

like image 666
brandizzi Avatar asked Mar 14 '11 22:03

brandizzi


People also ask

How do you tell if a day is a WORKDAY in Excel?

We can use the WORKDAY function to know if a day is a workday or not. This function calculates defined “workdays” dates in the future or past. It automatically excludes weekend dates and (optionally), holidays.

What is the WORKDAY formula?

=WORKDAY(start_date, days, [holidays]) The function uses the following arguments: Start_date (required function) – This is a date that represents the start date. Days (It is a required function) – The number of workdays to be added to start_date.

Can Excel identify working days?

Microsoft Excel provides two functions specially designed for calculating weekdays - WORKDAY and NETWORKDAYS. The WORKDAY function returns a date N working days in the future or in the past and you can use it to add or subtract workdays to a given date.


2 Answers

If you are into Java programming you can use this : Non-working day and Holiday Handler Algorithms

like image 78
Redger Avatar answered Sep 20 '22 03:09

Redger


Most people I know use a calendar table for this kind of thing. My table contains info for 80+ countries

like image 23
SQLMenace Avatar answered Sep 17 '22 03:09

SQLMenace