Finding Last Business Day of the month

I know it is confusing but this is something I have to accomplish recently. But if you really think about it, it’s very useful in many in-office applications.

Anyhow, after ample internet reading and searching, I finally figured it out

Here is how I did it. I’m sure there are plenty of ways of doing this, but to save you with the trouble I’m posting it. Feel free to use and and please comments thoughts, suggestions, etc.

And BTW, this snippet finds the Last Business Day of the month. With little bit of tweaking, it’s easy to find the first business day of next month. (I actually had to find both, in two different occurrences.) (Let me know if you want that)

Here we go,

Before we get into coding here is a scenario to think about. Let’s say we found what’s the last business day of the month, but what if that’s a company holiday…. aha problemo isn’t it? Not so much, if we factor that in to coding.

Now-a-days almost every company has a table of company holidays. This is usually managed by HR dept. and this list contains company holidays as well as national holidays.

Oh BTW, when this is running I made it pop up a cfwindow saying ‘today is the last business day of this month, do whatcha gotta do’

Last Business Day Code

UPDATE : 10/18/2013 Here is the Git.

Advertisements
Finding Last Business Day of the month

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s