how to determine if date is a Federal holiday

G

GiJeet

Is there a way to determine, via code, if a date falls on a holiday
for a specific year? Without having to create a database, populate it
with holidays for several years, making a connection to the db, then
comparing the dates?

TIA
G
 
P

Peter Morris

Considering there could be new holidays introduced at any point I would say
"No".
 
B

Ben

Let's just say there isn't going to be new holidays.
You still need to store the information: (1) In a database table, (2) In
an Excel spreadsheet (3) in a text/xml file (4) hard code in the
information, but that would be no-no.

It looks like there's no way to avoid the I/O operation.

Ben
 
S

sloan

The aspose iCalendar has methods to create rule based dates.
Its not trivial.

http://www.aspose.com/documentation....net/about-aspose-icalendar-object-model.html

http://www.aspose.com/categories/file-format-components/aspose.network-for-.net/default.aspx

The way I used it, was to create a rule.
Let's say ..... The third monday of every month.
I would actually create 2 years worth of dates, and store them in the
database.

You have a different need, but maybe you can work it through logic only.

.............

aspose is not free. but its a good investment.
 
G

GiJeet

S

sloan

//MS had an isHoliday function sort of like
DateTime.isHoliday
or isHoliday(date) and for any new holidays we could just extend it.
//

Don't berate MS for that one.

The rules change sometimes. Is Christmas and Easter a holiday? (For me it
is, for some it is not).
Is MLK birthday a holiday? His actual birthday or the Monday?
There is alot of undercurrent stuff in that simple request.

Holidays (some are kinda stupid ones) get passed each year in Congress as
well.

Get my leap year and day light savings time correct and I'll be happy.





GiJeet said:


Thanks, but I think I'll just go with creating a table and populating
it with dates.
would have been nice if MS had an isHoliday function sort of like
DateTime.isHoliday
or isHoliday(date) and for any new holidays we could just extend it.

G
 
S

sloan

http://en.wikipedia.org/wiki/Federal_holiday

Controversy (quoted from the wiki url above)
Some people have objected to honoring Martin Luther King, Jr. and/or
Christopher Columbus with holidays. As a result, Martin Luther King Day took
several years to gain national acceptance and is called "Civil Rights Day"
in some locations. Some local jurisdictions observe "Indigenous Peoples of
the Americas Day" instead of "Columbus Day". Similarly, some public schools
in the US re-name the vacation taken near and after Christmas "Winter
Holiday" or "Winter Break", to avoid the implication that all students are
obligated to observe Christian or nominally Christian holidays. State and
local legal names for any particular holiday do not have any bearing upon
the names of federal holidays.



Here is a thought that just came to me. You think Native Americans
celebrate Columbus Day?


Too much grey for MS to code up. Do you really want a SP or patch released
all the time for holidays?

Then MS would be blamed for that.

The alteration to daylights saving time was enough.
 
J

Jeff Johnson

Not to mention the fact that there's a whole world out there beyond the
USA...

Some folks are just upset that MS didn't include the

System.OmniscientClass.DoEverythingForMe(params details) method....
 
A

Arne Vajhøj

Jeff said:
Some folks are just upset that MS didn't include the

System.OmniscientClass.DoEverythingForMe(params details) method....

Do you have an implementation that we can steal ?

:)

Arne
 
J

jacerhea

Is there a way to determine, via code,  if a date falls on a holiday
for a specific year?  Without having to create a database, populate it
with holidays for several years, making a connection to the db, then
comparing the dates?

TIA
G

While you won't be able to get a dynamic list of holidays, if you know
the holidays are static it will be possible. For example, if you know
only the following holidays need to be observed: Martin Luther King
Day, Christmas, Thanksgiving, and Columbus day, you could write a
simple helper method to figure out when that day is occurring for a
particular year and compare it the requested data.

MLK day = 3rd Monday of January
Xmas = 25th of December
Thanksgiving = 4th Thursday of November
Columbus Day = 2nd Monday in October
 
R

rustylee

While you won't be able to get a dynamic list of holidays, if you know
the holidays are static it will be possible.  For example, if you know
only the following holidays need to be observed: Martin Luther King
Day, Christmas, Thanksgiving, and Columbus day, you could write a
simple helper method to figure out when that day is occurring for a
particular year and compare it the requested data.

MLK day = 3rd Monday of January
Xmas = 25th of December
Thanksgiving = 4th Thursday of November
Columbus Day = 2nd Monday in October

That seems like the most logical way to handle it. The dates seem
predictable enough.

I have friend who works in the Federal Court system and he gets 13
paid holidays.

What I want to know is when will the Federal government fill in some
holidays for March, April, and August. It's tough going from Feb to
the end of May without a Federal holiday : ) Need more "teacher days"
as well so our kids can have more three-day weekends. Builds their
character leaving them home alone one Monday or Friday each month.
Can't expect teachers to spend any of their summer, or "off track"
time, for "teacher days."

But I digress.

-Rusty
 
T

Todd Carnes

GiJeet said:


Thanks, but I think I'll just go with creating a table and populating
it with dates.
would have been nice if MS had an isHoliday function sort of like
DateTime.isHoliday
or isHoliday(date) and for any new holidays we could just extend it.

G

That doesn't really seem very practical to me.

Todd
 
T

Todd Carnes

Mark Rae said:
It's pretty much the "standard" way of doing it - certainly the
simplest...

True, but I was thinking about how the holidays change all the time.

Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top