[Haskell-beginners] Is there a function to determine if a date is a business day?

Andy Elvey andy.elvey at paradise.net.nz
Fri Dec 11 01:43:52 EST 2009


Colin Paul Adams wrote:
> You will need to write it, as it depends upon your definition of what
> a business day is.
> This tends to be country-specific (at least).
>   
Agreed. 
I'm a Haskell-newbie so I can't give the Haskell code for this, but in 
"pseudo-code" it would be something like this -

holidays_list = ["09JAN", "06FEB", ..... ]   ( This will vary depending 
on country  ) 

if myday not in holidays_list and day(myday) in ["Mon", "Tue", "Wed", 
"Thu", "Fri"]
  then business_day(myday) = "Yes"
  else business_day(myday) = "No"

Some countries have a "Holidays Act" or similar legislation which 
specifies the holidays for the current year and the next few years.

Hope this helps.... :)
- Andy



More information about the Beginners mailing list